Module: Airbrake::Loggable Private

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

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 Loggable.instance method before calling #logger.

Examples:

class A
  include Loggable

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

Since:

  • v4.0.0

Class Attribute Summary collapse

Instance Method Summary collapse

Class Attribute Details

.instanceLogger

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Logger)

Since:

  • v4.0.0



24
25
26
# File 'lib/airbrake-ruby/loggable.rb', line 24

def instance
  @instance ||= ::Logger.new(File::NULL).tap { |l| l.level = ::Logger::WARN }
end

Instance Method Details

#loggerLogger

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns standard Ruby logger object.

Returns:

  • (Logger)

    standard Ruby logger object

Since:

  • v4.0.0



30
31
32
# File 'lib/airbrake-ruby/loggable.rb', line 30

def logger
  Loggable.instance
end