Skip to content

Commit

Permalink
Only assign to @filename if the path is valid. (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix authored Dec 8, 2022
1 parent 8915627 commit b41d7c6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/logger/log_device.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ def reopen(log = nil)
def set_dev(log)
if log.respond_to?(:write) and log.respond_to?(:close)
@dev = log
if log.respond_to?(:path)
@filename = log.path
if log.respond_to?(:path) and path = log.path
if File.exist?(path)
@filename = path
end
end
else
@dev = open_logfile(log)
Expand Down

0 comments on commit b41d7c6

Please sign in to comment.