summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-05-16 17:35:21 -0700
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-07-15 14:43:08 +0900
commitf4064a0a0c24734b1ec98e6e2dbdf5e38e856c41 (patch)
tree8d6ef836c38a27ea960159370ddcafab8df0f890 /lib
parent2c22051b4b54482531e43915f5edef0c3d3a053b (diff)
downloadruby-f4064a0a0c24734b1ec98e6e2dbdf5e38e856c41.tar.gz
[ruby/logger] Set filename when initializing logger with a File object
This should allow reopen to work. Requested in ruby issue #14595. https://github.com/ruby/logger/commit/bd367aff12
Diffstat (limited to 'lib')
-rw-r--r--lib/logger/log_device.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/logger/log_device.rb b/lib/logger/log_device.rb
index d287a470fc..c6dc43c11a 100644
--- a/lib/logger/log_device.rb
+++ b/lib/logger/log_device.rb
@@ -76,6 +76,9 @@ class Logger
def set_dev(log)
if log.respond_to?(:write) and log.respond_to?(:close)
@dev = log
+ if log.respond_to?(:path)
+ @filename = log.path
+ end
else
@dev = open_logfile(log)
@dev.sync = true