class Honeybadger::Logging::ConfigLogger
Constants
- CALLER_LOCATION
- DEBUG_SUPPLEMENT
- INFO_SUPPLEMENT
- LOCATE_CALLER_LOCATION
Public Class Methods
Source
# 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
Calls superclass method
Honeybadger::Logging::StandardLogger::new
Public Instance Methods
Source
# 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
Calls superclass method
Honeybadger::Logging::StandardLogger#add
Private Instance Methods
Source
# File lib/honeybadger/logging.rb, line 170 def caller_location if caller && caller.find {|l| l !~ LOCATE_CALLER_LOCATION && l =~ CALLER_LOCATION } Regexp.last_match(1) end end
Source
# File lib/honeybadger/logging.rb, line 158 def supplement(msg, severity) return msg unless msg.kind_of?(String) r = msg.dup r << sprintf(INFO_SUPPLEMENT, severity, Process.pid) if severity == Logger::Severity::DEBUG && l = caller_location r << sprintf(DEBUG_SUPPLEMENT, l.dump) end r end
Source
# File lib/honeybadger/logging.rb, line 150 def suppress_debug? !debug? end
Source
# File lib/honeybadger/logging.rb, line 154 def suppress_tty?(severity) @tty && severity < @tty_level end