lib/honeybadger/logging.rb in honeybadger-4.3.1 vs lib/honeybadger/logging.rb in honeybadger-4.4.0

- old
+ new

@@ -5,10 +5,11 @@ module Honeybadger # @api private module Logging PREFIX = '** [Honeybadger] '.freeze + LOGGER_PROG = "honeybadger".freeze # Logging helper methods. Requires a Honeybadger::Config @config instance # variable to exist and/or #logger to be defined. Each method is # defined/block captured in this module rather than delegating to the # logger directly to avoid extra object allocation. @@ -91,15 +92,19 @@ raise ArgumentError, 'logger must be a logger' unless logger.respond_to?(:add) @logger = logger end - def_delegators :@logger, :level, :add, :debug?, :info?, :warn?, :error? + def add(severity, msg, progname=LOGGER_PROG) + @logger.add(severity, msg, progname) + end + + def_delegators :@logger, :level, :debug?, :info?, :warn?, :error? end class FormattedLogger < StandardLogger - def add(severity, msg) - super(severity, format_message(msg)) + def add(severity, msg, progname=LOGGER_PROG) + super(severity, format_message(msg), progname) end private def format_message(msg)