logging stuff
This commit is contained in:
parent
e9e7f16b44
commit
74f1fcf529
1 changed files with 8 additions and 1 deletions
|
@ -80,10 +80,17 @@ class Bot(object):
|
|||
fh = logging.FileHandler(log_name)
|
||||
fh.setLevel(logging.DEBUG)
|
||||
|
||||
# stdout handler
|
||||
sh = logging.StreamHandler()
|
||||
sh.setLevel(logging.INFO)
|
||||
|
||||
# create a formatter and set the formatter for the handler.
|
||||
frmt = logging.Formatter('%(asctime)s [%(levelname)s] %(message)s')
|
||||
fh.setFormatter(frmt)
|
||||
simplefrmt = logging.Formatter('[%(levelname)s] %(message)s')
|
||||
sh.setFormatter(simplefrmt)
|
||||
|
||||
# add the Handler to the logger
|
||||
# add the Handlers to the logger
|
||||
logger.addHandler(fh)
|
||||
logger.addHandler(sh)
|
||||
return logger
|
||||
|
|
Reference in a new issue