aserafin / grape_logging

Request logging for Grape!
MIT License
147 stars 76 forks source link

Make formatter optional #23

Closed aserafin closed 8 years ago

aserafin commented 8 years ago

There are logger implementations that don't expose `.formatter. Make grape-logging compatible with them!

guizmaii commented 8 years ago

Maybe just add a if like that could solve the problem in LoggerReporter#initialize :

@logger.formatter = formatter || GrapeLogging::Formatters::Default.new if @logger.respond_to?(:formatter)
aserafin commented 8 years ago

Exactly my thinking :) 15.03.2016 3:23 PM "Jules Ivanic" notifications@github.com napisał(a):

Maybe just add a if like that could solve the problem in LoggerReporter#initialize :

@logger.formatter = formatter || GrapeLogging::Formatters::Default.new if @logger.respond_to?(:formatter)

— You are receiving this because you were assigned. Reply to this email directly or view it on GitHub: https://github.com/aserafin/grape_logging/issues/23#issuecomment-196843573

guizmaii commented 8 years ago

I'm not so able to test but I pushed you the modification #24 ;)

guizmaii commented 8 years ago

Actually it's not @logger.respond_to?(:formatter) but @logger.respond_to?(:formatter=) that we should test, I think.

aserafin commented 8 years ago

Merged #24 which should solve the issue. Thanks @guizmaii :+1: