From 0202b5a7fe74f730de3693025f45b884c4736be3 Mon Sep 17 00:00:00 2001 From: Justwannasleep <39079024+Justwannasleep@users.noreply.github.com> Date: Mon, 11 Oct 2021 20:46:23 +0800 Subject: [PATCH] Update tools.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复使用cong.ini时报错的问题。需要指定ini 文件中logger_file 的 qualname字段为AutoMihoyoBBS --- tools.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools.py b/tools.py index b7185b7..15cbb8f 100644 --- a/tools.py +++ b/tools.py @@ -10,14 +10,15 @@ import setting #Log输出,这里提供了自定义logging输出的机会,只需要创建一个logging.ini并且写入配置文件即可自定义输出 if os.path.exists(f"{config.path}/logging.ini"): + import logging.config logging.config.fileConfig(f"{config.path}/logging.ini") + log = logging.getLogger("AutoMihoyoBBS") else: logging.basicConfig( level=logging.INFO, format='%(asctime)s %(levelname)s %(message)s', datefmt='%Y-%m-%dT%H:%M:%S') - -log = logger = logging + log = logger = logging #md5计算 def MD5(text:str) -> str: @@ -74,4 +75,4 @@ def Get_openssl_Version() ->int: #建议直接更新Python的版本,有特殊情况请提交issues exit(-1) temp_List = ssl.OPENSSL_VERSION_INFO - return int(f"{str(temp_List[0])}{str(temp_List[1])}{str(temp_List[2])}") \ No newline at end of file + return int(f"{str(temp_List[0])}{str(temp_List[1])}{str(temp_List[2])}")