Use logger when errors occur

This commit is contained in:
taizan-hokuto
2019-11-20 23:59:16 +09:00
parent 817fed9d1d
commit 0e060bf998
4 changed files with 11 additions and 10 deletions

View File

@@ -17,7 +17,7 @@ def get_logger(modname,mode=logging.DEBUG):
logger.addHandler(handler1)
#create handler2 for recording log file
if mode <= logging.DEBUG:
handler2 = logging.FileHandler(filename="log.txt")
handler2 = logging.FileHandler(filename="log.txt", encoding='utf-8')
handler2.setLevel(logging.ERROR)
handler2.setFormatter(my_formatter)