fix: force UTF-8 on console output to avoid GBK encoding errors
Windows Chinese locale defaults stdout to GBK which cannot encode emoji characters used in log messages. Reconfigure stdout to UTF-8. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -48,7 +48,8 @@ class LoggerManager:
|
||||
file_handler.setFormatter(file_formatter)
|
||||
_logger.addHandler(file_handler)
|
||||
|
||||
# 控制台处理器
|
||||
# 控制台处理器(强制 UTF-8 避免 GBK 编码错误)
|
||||
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
|
||||
console_handler = logging.StreamHandler(sys.stdout)
|
||||
console_formatter = logging.Formatter(LOG_FORMAT, DATE_FORMAT)
|
||||
console_handler.setFormatter(console_formatter)
|
||||
|
||||
Reference in New Issue
Block a user