Class: Honeybadger::Logging::ConfigLogger Private

Inherits:
StandardLogger show all
Defined in:
lib/honeybadger/logging.rb

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

Constant Summary collapse

LOCATE_CALLER_LOCATION =

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

Regexp.new("#{Regexp.escape(__FILE__)}").freeze
CALLER_LOCATION =

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

Regexp.new("#{Regexp.escape(File.expand_path('../../../', __FILE__))}/(.*)").freeze
INFO_SUPPLEMENT =

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

' level=%s pid=%s'.freeze
DEBUG_SUPPLEMENT =

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

' at=%s'.freeze

Instance Method Summary collapse

Methods inherited from Base

#level

Constructor Details

#initialize(config, logger = Logger.new(nil)) ⇒ ConfigLogger

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 a new instance of ConfigLogger.



124
125
126
127
128
129
# File 'lib/honeybadger/logging.rb', line 124

def initialize(config, logger = Logger.new(nil))
  @config = config
  @tty = STDOUT.tty?
  @tty_level = @config.log_level(:'logging.tty_level')
  super(logger)
end

Instance Method Details

#add(severity, msg) ⇒ Object

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.



131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/honeybadger/logging.rb', line 131

def add(severity, msg)
  return true if suppress_tty?(severity)

  # There is no debug level in Honeybadger. Debug logs will be logged at
  # the info level if the debug config option is on.
  if severity == Logger::Severity::DEBUG
    return true if suppress_debug?
    super(Logger::Severity::INFO, supplement(msg, Logger::Severity::DEBUG))
  else
    super(severity, supplement(msg, severity))
  end
end

#debug?Boolean

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:

  • (Boolean)


144
145
146
# File 'lib/honeybadger/logging.rb', line 144

def debug?
  @config.log_debug?
end