Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: logger methods to return nil #3

Open
olleolleolle opened this issue Jan 25, 2017 · 2 comments
Open

Feature request: logger methods to return nil #3

olleolleolle opened this issue Jan 25, 2017 · 2 comments

Comments

@olleolleolle
Copy link
Contributor

olleolleolle commented Jan 25, 2017

I would expect that the return value from using a logger method like debug or info would be nil.

The following example is from a bin/console session using the code example from the documentation. The return value from a log line being printed is a here list of logger outputters/formatters (not falsy).

2.4.0 :004 > Ecraft::LoggingLibrary
 => Ecraft::LoggingLibrary 
2.4.0 :005 > class MyClass
2.4.0 :006?>   include Ecraft::LoggingLibrary::Loggable
2.4.0 :007?>   def load_data_from_database
2.4.0 :008?>       logger.info('Starting to load data from database')
2.4.0 :009?>     end
2.4.0 :010?>   end
 => :load_data_from_database 
2.4.0 :011 > c=MyClass.new
 => #<MyClass:0x007ff8a38a19b8> 
2.4.0 :012 > c.load_data_from_database
INFO  [2017-01-25 17:55:37.617] MyClass: Starting to load data from database
 => [#<Logger:0x007ff8a284f538 @level=1, @progname="MyClass", @default_formatter=#<Logger::Formatter:0x007ff8a284f4e8 @datetime_format=nil>, @formatter=#<Ecraft::LoggingLibrary::CustomFormatter:0x007ff8a284f268 @datetime_format=nil>, @logdev=#<Logger::LogDevice:0x007ff8a284f470 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDOUT>>, @mon_owner=nil, @mon_count=0, @mon_mutex=#<Thread::Mutex:0x007ff8a284f3f8>>>] 

@olleolleolle olleolleolle changed the title Feature request: logger method to return nil Feature request: logger methods to return nil Jan 25, 2017
@perlun
Copy link
Contributor

perlun commented Feb 8, 2017

Makes sense. The problem is that the logger methods are defined upstream, in the mixlib-log gem though. We can override them ourselves...

@olleolleolle
Copy link
Contributor Author

I had registered this issue, on Jan 25:
chef/mixlib-log#21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants