We nil the internal variable, but we should not close the logger itself,
since this leads to STDERR being closed and the interpreter reopening it
for its own needs, or something like that, which ultimately leads to
the interpreter's warning appearing in console (probably due to ruby
itself reopening stderr to be able to output the messages).
If we simply nil the variable, the interpreter is content with sending
us the messages per our shenanigangs, and everything works just as
expected.
end
def disable_console_logger
end
def disable_console_logger
- @console_logger.close if @console_logger
@console_logger = nil
end
@console_logger = nil
end
end
def log_session_start
end
def log_session_start
+ # if we forked, the thread may be dead, so let's restart it if necessary
+ start_thread
if @file_logger
@file_logger << "\n\n=== session started on #{Time.now.strftime(@dateformat)} ===\n\n"
end
if @file_logger
@file_logger << "\n\n=== session started on #{Time.now.strftime(@dateformat)} ===\n\n"
end