lib/berkshelf/logger.rb in berkshelf-7.0.8 vs lib/berkshelf/logger.rb in berkshelf-7.0.9

- old
+ new

@@ -1,11 +1,11 @@ module Berkshelf class Logger < Logger def initialize(device = STDOUT) super self.level = Logger::WARN - @filter_params = Array.new + @filter_params = [] end # Reimplements Logger#add adding message filtering. The info, # warn, debug, error, and fatal methods all call add. # @@ -26,20 +26,22 @@ def add(severity, message = nil, progname = nil, &block) severity ||= Logger::UNKNOWN if @logdev.nil? || severity < (@level) return true end + progname ||= @progname if message.nil? if block_given? message = yield else message = progname progname = @progname end end @logdev.write( - format_message(format_severity(severity), Time.now, progname, filter(message))) + format_message(format_severity(severity), Time.now, progname, filter(message)) + ) true end def filter_params @filter_params.dup