Skip to content

Commit

Permalink
Fix already configured logger formatter override (aserafin#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
e1senh0rn authored and aserafin committed Mar 1, 2017
1 parent 3828b50 commit 48adb78
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/grape_logging/reporters/logger_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ module Reporters
class LoggerReporter
def initialize(logger, formatter)
@logger = logger || Logger.new(STDOUT)
@logger.formatter = formatter || GrapeLogging::Formatters::Default.new if @logger.respond_to?(:formatter=)
if @logger.respond_to?(:formatter=)
@logger.formatter = formatter || @logger.formatter || GrapeLogging::Formatters::Default.new
end
end

def perform(params)
Expand Down

0 comments on commit 48adb78

Please sign in to comment.