diff options
author | sonots <sonots@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-07-20 16:47:26 +0000 |
---|---|---|
committer | sonots <sonots@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-07-20 16:47:26 +0000 |
commit | 93fe0ff2f1a2818523799d3da68cade115bec783 (patch) | |
tree | fd13db21cbf1b354aabad69dd82b7a188a5f37a1 /lib | |
parent | 1da648310d759e163620507ef0955eb5f0b76c32 (diff) | |
download | ruby-93fe0ff2f1a2818523799d3da68cade115bec783.tar.gz |
logger.rb: Fix handling progname
Because progname was memoized with ||= a logger call that involved
outputting false would be nil. Example code:
logger = Logger.new(STDOUT)
logger.info(false) # => nil
Perform an explicit nil check instead of ||= so that false will be output.
patched by Gavin Miller <gavingmiller@gmail.com> [Fix GH-1667]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/logger.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/logger.rb b/lib/logger.rb index 8be1c26664..f572921db4 100644 --- a/lib/logger.rb +++ b/lib/logger.rb @@ -457,7 +457,9 @@ class Logger if @logdev.nil? or severity < @level return true end - progname ||= @progname + if progname.nil? + progname = @progname + end if message.nil? if block_given? message = yield |