X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=lib%2Frbot%2Fircbot.rb;h=4eac68d610c1056e71910a35352fe80731a6d79e;hb=98446561cf3c7126dd93b34c9be361fa4aa8da36;hp=ecb48449dc284b477bd7cb9379f4eda58ae028bb;hpb=0368e8c09385a6c49e0d59cd6162675057e5b339;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index ecb48449..4eac68d6 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -403,6 +403,8 @@ class Bot debug "Using `#{@logfile}' as debug log" end + LoggerManager.instance.flush + # See http://blog.humlab.umu.se/samuel/archives/000107.html # for the backgrounding code if $daemonize @@ -421,8 +423,11 @@ class Bot # File.umask 0000 # Ensure sensible umask. Adjust as needed. end - # setup logger based on bot configuration - LoggerManager.instance.set_level(@config['log.level']) + # setup logger based on bot configuration, if not set from the command line + loglevel_set = $opts.has_key?('debug') or $opts.has_key?('loglevel') + LoggerManager.instance.set_level(@config['log.level']) unless loglevel_set + + # Set the logfile LoggerManager.instance.set_logfile(@logfile, @config['log.keep'], @config['log.max_size']) if $daemonize