feat(core): 更新日志记录级别,增强调试信息

- 将多个模块中的日志记录级别从info调整为debug,以减少生产环境中的日志噪声,同时在调试模式下提供更详细的信息。
- 更新了主窗口、下载管理器、隐私管理器等多个文件的日志记录,确保在调试过程中能够获取到更丰富的上下文信息,便于问题排查和用户反馈。
This commit is contained in:
hyb-oyqq
2025-08-13 11:45:28 +08:00
parent ac2b0112e8
commit 43a66f66a9
14 changed files with 155 additions and 74 deletions

View File

@@ -105,8 +105,8 @@ class OfflineModeManager:
debug_mode = self._is_debug_mode()
# 无论是否为调试模式,都记录扫描操作
logger.info(f"扫描离线补丁文件,目录: {directory}")
# 记录扫描操作
logger.debug(f"扫描离线补丁文件,目录: {directory}")
# 要查找的补丁文件名
patch_files = ["vol.1.7z", "vol.2.7z", "vol.3.7z", "vol.4.7z", "after.7z"]
@@ -149,7 +149,7 @@ class OfflineModeManager:
if found_patches:
logger.info(f"共找到 {len(found_patches)} 个离线补丁文件: {list(found_patches.keys())}")
else:
logger.info("未找到任何离线补丁文件")
logger.debug("未找到任何离线补丁文件")
return found_patches
@@ -208,8 +208,8 @@ class OfflineModeManager:
ui_manager.online_mode_action.setChecked(not enabled)
ui_manager.offline_mode_action.setChecked(enabled)
# 无论是否为调试模式,都记录离线模式状态变化
logger.info(f"离线模式已{'启用' if enabled else '禁用'}")
# 记录离线模式状态变化
logger.debug(f"离线模式已{'启用' if enabled else '禁用'}")
if debug_mode:
logger.debug(f"DEBUG: 离线模式已{'启用' if enabled else '禁用'}")
@@ -642,14 +642,14 @@ class OfflineModeManager:
if install_path and os.path.exists(install_path):
try:
os.remove(install_path)
logger.info(f"已删除校验失败的文件: {install_path}")
logger.debug(f"已删除校验失败的文件: {install_path}")
# 检查是否为NEKOPARA After同时删除签名文件
if game_version == "NEKOPARA After":
sig_path = f"{install_path}.sig"
if os.path.exists(sig_path):
os.remove(sig_path)
logger.info(f"已删除签名文件: {sig_path}")
logger.debug(f"已删除签名文件: {sig_path}")
except Exception as e:
logger.error(f"删除文件失败: {e}")
@@ -833,7 +833,7 @@ class OfflineModeManager:
# 开始执行第一个安装任务
if install_tasks:
if debug_mode:
logger.info(f"DEBUG: 开始离线安装流程,安装游戏数量: {len(install_tasks)}")
logger.debug(f"开始离线安装流程,安装游戏数量: {len(install_tasks)}")
self.process_next_offline_install_task(install_tasks)
return True
else:
@@ -886,7 +886,7 @@ class OfflineModeManager:
if not install_tasks:
# 所有任务完成,进行后检查
if debug_mode:
logger.info("DEBUG: 所有离线安装任务完成,进行后检查")
logger.debug("所有离线安装任务完成,进行后检查")
# 使用patch_detector进行安装后哈希比较
self.main_window.patch_detector.after_hash_compare()