Project

General

Profile

Bug #8567

Logger#add can never return +false+

Added by timpease (Tim Pease) over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin12.3.0]
[ruby-core:<unknown>]

Description

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 (Hiroshi Nakamura) back in 2003. The documentation was clarified in 2012 by drbrain (Eric Hodel) 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.

Associated revisions

Revision 41901
Added by zzak (Zachary Scott) over 4 years ago

  • lib/logger.rb (#add): Remove incorrect rdoc for return value [Bug #8567] Reported by Tim Pease.

Revision 41901
Added by zzak (Zachary Scott) over 4 years ago

  • lib/logger.rb (#add): Remove incorrect rdoc for return value [Bug #8567] Reported by Tim Pease.

Revision 41901
Added by zzak (Zachary Scott) over 4 years ago

  • lib/logger.rb (#add): Remove incorrect rdoc for return value [Bug #8567] Reported by Tim Pease.

Revision 41901
Added by zzak (Zachary Scott) over 4 years ago

  • lib/logger.rb (#add): Remove incorrect rdoc for return value [Bug #8567] Reported by Tim Pease.

History

#1 [ruby-core:55634] Updated by drbrain (Eric Hodel) over 4 years ago

Likely the documentation of the return value is in error and should be removed.

#2 [ruby-core:55901] Updated by zzak (Zachary Scott) over 4 years ago

  • Category set to doc
  • Status changed from Open to Assigned
  • Assignee set to zzak (Zachary Scott)

#3 Updated by zzak (Zachary Scott) over 4 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r41901.
Tim, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • lib/logger.rb (#add): Remove incorrect rdoc for return value [Bug #8567] Reported by Tim Pease.

Also available in: Atom PDF