module Airbrake::Loggable

Loggable is included into any class that wants to be able to log.

By default, Loggable defines a null logger that doesn't do anything. You are supposed to overwrite it via the {instance} method before calling {logger}.

@example

class A
  include Loggable

  def initialize
    logger.debug('Initialized A')
  end
end

@since v4.0.0 @api private

Attributes

instance[W]

@return [Logger]

Public Class Methods

instance() click to toggle source

@return [Logger]

# File lib/airbrake-ruby/loggable.rb, line 24
def instance
  @instance ||= ::Logger.new(File::NULL).tap { |l| l.level = ::Logger::WARN }
end

Public Instance Methods

logger() click to toggle source

@return [Logger] standard Ruby logger object

# File lib/airbrake-ruby/loggable.rb, line 30
def logger
  Loggable.instance
end