From 0368e8c09385a6c49e0d59cd6162675057e5b339 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sat, 29 May 2021 17:20:50 +0200 Subject: fix: preserve loglevels across options and files --- bin/rbot | 2 +- lib/rbot/logger.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/rbot b/bin/rbot index 86f907cf..82ee9c9a 100755 --- a/bin/rbot +++ b/bin/rbot @@ -114,7 +114,7 @@ end if(bot = Irc::Bot.new(ARGV.shift, :argv => orig_opts)) # setup logger based on command line arguments loglevel = $opts['loglevel'] ? $opts['loglevel'].to_i : nil - loglevel = $opts['debug'] ? 0 : nil + loglevel = $opts['debug'] ? 0 : loglevel if loglevel Irc::Bot::LoggerManager.instance.set_level(loglevel) end diff --git a/lib/rbot/logger.rb b/lib/rbot/logger.rb index 1598f7bd..b5f615d7 100644 --- a/lib/rbot/logger.rb +++ b/lib/rbot/logger.rb @@ -29,6 +29,7 @@ class Bot def set_logfile(filename, keep, max_size) @file_logger = Logger.new(filename, keep, max_size*1024*1024) @file_logger.datetime_format = @dateformat + @file_logger.level = @logger.level end def set_level(level) -- cgit v1.2.3