1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-12 05:08:19 +08:00

Fix: Log charset set to UTF-8

The default character encoding of "logging" is cp1252, which is not able to encode CJK chars.
This commit is contained in:
noname94
2020-09-15 20:45:20 +09:00
parent 2da0d472e0
commit 82277e3d5a

View File

@@ -39,10 +39,10 @@ if '_' in pyw_name:
pyw_name = '_'.join(pyw_name.split('_')[:-1])
log_file = f'./log/{datetime.date.today()}_{pyw_name}.txt'
try:
file = logging.FileHandler(log_file)
file = logging.FileHandler(log_file, encoding='utf-8')
except FileNotFoundError:
os.mkdir('./log')
file = logging.FileHandler(log_file)
file = logging.FileHandler(log_file, encoding='utf-8')
file.setFormatter(formatter)
logger.addHandler(file)