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__).to_s).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.



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

def initialize(config, logger = Logger.new(nil))
  @config = config
  @log_level = @config.log_level
  @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.



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

def add(severity, msg)
  return true if suppress_log_level?(severity)
  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)


147
148
149
# File 'lib/honeybadger/logging.rb', line 147

def debug?
  @config.log_debug?
end