mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/logger] Set filename when initializing logger with a File object
This should allow reopen to work. Requested in ruby issue #14595.
bd367aff12
This commit is contained in:
parent
2c22051b4b
commit
f4064a0a0c
2 changed files with 18 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue