Logger#add can never return +false+
|ruby -v:||ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin12.3.0]||Backport:||1.9.3: UNKNOWN, 2.0.0: UNKNOWN|
The ruby Logger in the stdlib has a discrepancy between the documentation and the source code. The documentation states "=== Return +true+ if successful, +false+ otherwise" (https://github.com/ruby/ruby/blob/trunk/lib/logger.rb#L342-L347). However, there is no code path that allows +false+ to be returned from this method.
The code was originally included in the stdlib by @nahi back in 2003. The documentation was clarified in 2012 by @drbrain to indicate that the method will return +true+ regardless of the success or failure of the method.
My expectation would be for this method to return +false+ if the message was not logged. This code block (https://github.com/ruby/ruby/blob/trunk/lib/logger.rb#L370-L372) would be the logical place in the code to return +false+; in this case the message was not logged successfully.
This affects all version of Ruby.
#3 Updated by Zachary Scott 10 months ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100