utils: change notify level to info

This commit is contained in:
JerryXiao 2019-09-06 12:10:47 +08:00
parent 7f807b3197
commit 82cf5c7c14
Signed by: Jerry
GPG key ID: 9D9CE43650FF2BAA

View file

@ -285,11 +285,8 @@ def configure_logger(logger, format='%(asctime)s - %(name)-18s - %(levelname)s -
return fmtr return fmtr
logger.setLevel(logging.DEBUG) logger.setLevel(logging.DEBUG)
fnotify = cnotify = False fformatter = ExceptionFormatter(fmt=format, notify=False)
fnotify = True if enable_notify and logfile else False cformatter = ExceptionFormatter(fmt=format, notify=True)
cnotify = True if enable_notify and (not logfile) else False
fformatter = ExceptionFormatter(fmt=format, notify=fnotify)
cformatter = ExceptionFormatter(fmt=format, notify=cnotify)
logging.addLevelName(49, 'Exception') logging.addLevelName(49, 'Exception')
# create file handler # create file handler
if logfile: if logfile:
@ -311,7 +308,6 @@ def configure_logger(logger, format='%(asctime)s - %(name)-18s - %(levelname)s -
assert type(consolelog) is str assert type(consolelog) is str
cfh = logging.FileHandler(consolelog) cfh = logging.FileHandler(consolelog)
cfh.setLevel(level) cfh.setLevel(level)
cfhformatter = ExceptionFormatter(fmt=format, notify=False) cfh.setFormatter(cformatter)
cfh.setFormatter(cfhformatter)
logger.addHandler(cfh) logger.addHandler(cfh)
# for client.printlog # for client.printlog