小批量收尾:删除零引用 scrcpy_screenshot + douyin_fudai/log_viewer print→logger
- 删除 operations/scrcpy_screenshot.py(100 行,仅自身定义自身使用,全仓零外部引用) - douyin/core/douyin_fudai.py:3 处兜底 print → logging.info/warning(_log_kv 失败时的兜底路径) - gui/components/log_viewer.py:2 处错误 print → _LOGVIEW_LOGGER.exception(日志线程异常 / 刷新显示异常) 回归:149→148 .py,全量编译通过;test_filter_logging / check_web_gui_config_sync 通过; fudai_analyse 类正常导出,log_viewer 模块加载 OK。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
1 parent
938011f672
commit
96f8600d42
3 files changed
+9
-105
No files matched your search
@@ -7,6 +7,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Callable, Optional, List, Dict, Tuple
|
||||
import logging
|
||||
import queue
|
||||
import re
|
||||
import threading
|
||||
@@ -16,6 +17,9 @@ import tkinter as tk
|
||||
from tkinter import ttk
|
||||
from tkinter.scrolledtext import ScrolledText
|
||||
|
||||
# 模块级 logger:内部错误(日志线程异常 / 刷新显示异常)走 logging,避免裸 print
|
||||
_LOGVIEW_LOGGER = logging.getLogger("gui.components.log_viewer")
|
||||
|
||||
try:
|
||||
from ttkbootstrap.scrolled import ScrolledText as TBSrolledText
|
||||
ScrolledText = TBSrolledText
|
||||
@@ -230,7 +234,7 @@ class EnhancedLogViewer(ttk.Frame):
|
||||
break
|
||||
|
||||
except Exception as e:
|
||||
print(f"日志处理错误: {e}")
|
||||
_LOGVIEW_LOGGER.exception("日志处理错误: %s", e)
|
||||
|
||||
time.sleep(0.1) # 避免CPU占用过高
|
||||
|
||||
@@ -343,7 +347,7 @@ class EnhancedLogViewer(ttk.Frame):
|
||||
self.log_text.see("end")
|
||||
|
||||
except Exception as e:
|
||||
print(f"刷新显示错误: {e}")
|
||||
_LOGVIEW_LOGGER.exception("刷新显示错误: %s", e)
|
||||
|
||||
def _insert_colored_line(self, line: str) -> None:
|
||||
"""插入带颜色的日志行"""
|
||||
|
||||
Reference in new issue
Block a user