Fix logger level filtering

This commit is contained in:
nemunaire 2015-05-14 11:12:13 +02:00
parent f9ee107403
commit f9f54989fe

View File

@ -67,21 +67,19 @@ def main():
# Setup loggin interface # Setup loggin interface
import logging import logging
logger = logging.getLogger("nemubot") logger = logging.getLogger("nemubot")
logger.setLevel(logging.DEBUG)
formatter = logging.Formatter( formatter = logging.Formatter(
'%(asctime)s %(name)s %(levelname)s %(message)s') '%(asctime)s %(name)s %(levelname)s %(message)s')
ch = logging.StreamHandler() ch = logging.StreamHandler()
ch.setFormatter(formatter) ch.setFormatter(formatter)
if args.verbose > 1: if args.verbose < 2:
ch.setLevel(logging.DEBUG)
else:
ch.setLevel(logging.INFO) ch.setLevel(logging.INFO)
logger.addHandler(ch) logger.addHandler(ch)
fh = logging.FileHandler(args.logfile) fh = logging.FileHandler(args.logfile)
fh.setFormatter(formatter) fh.setFormatter(formatter)
fh.setLevel(logging.DEBUG)
logger.addHandler(fh) logger.addHandler(fh)
# Add modules dir paths # Add modules dir paths