mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-27 10:55:49 +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:
@@ -39,10 +39,10 @@ if '_' in pyw_name:
|
|||||||
pyw_name = '_'.join(pyw_name.split('_')[:-1])
|
pyw_name = '_'.join(pyw_name.split('_')[:-1])
|
||||||
log_file = f'./log/{datetime.date.today()}_{pyw_name}.txt'
|
log_file = f'./log/{datetime.date.today()}_{pyw_name}.txt'
|
||||||
try:
|
try:
|
||||||
file = logging.FileHandler(log_file)
|
file = logging.FileHandler(log_file, encoding='utf-8')
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
os.mkdir('./log')
|
os.mkdir('./log')
|
||||||
file = logging.FileHandler(log_file)
|
file = logging.FileHandler(log_file, encoding='utf-8')
|
||||||
file.setFormatter(formatter)
|
file.setFormatter(formatter)
|
||||||
logger.addHandler(file)
|
logger.addHandler(file)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user