OCR调试截图自动清理:从60张降至6张
- 微信和QQ截图统一池,合计最多6张 - 超过时从最早开始删除覆盖 - 确保保存失败时日志未打印也能通过截图及时发现问题
This commit is contained in:
+2
-2
@@ -1249,7 +1249,7 @@ class MessageMonitor:
|
|||||||
_dbg_path = os.path.join(script_dir, f"ocr_debug_qq_{ts}.png")
|
_dbg_path = os.path.join(script_dir, f"ocr_debug_qq_{ts}.png")
|
||||||
im.save(_dbg_path)
|
im.save(_dbg_path)
|
||||||
logger.debug(f"[qq] 调试截图: {_dbg_path}")
|
logger.debug(f"[qq] 调试截图: {_dbg_path}")
|
||||||
_clean_old_ocr_debug(script_dir, keep=60)
|
_clean_old_ocr_debug(script_dir, keep=6)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"[qq] 调试截图保存失败: {e} (路径: {os.path.join(script_dir, 'ocr_debug_qq_*.png')})")
|
logger.warning(f"[qq] 调试截图保存失败: {e} (路径: {os.path.join(script_dir, 'ocr_debug_qq_*.png')})")
|
||||||
|
|
||||||
@@ -1352,7 +1352,7 @@ class MessageMonitor:
|
|||||||
im.save(_dbg_path)
|
im.save(_dbg_path)
|
||||||
logger.debug(f"[wechat] 调试截图: {_dbg_path}")
|
logger.debug(f"[wechat] 调试截图: {_dbg_path}")
|
||||||
# 清理 ocr_debug_* 调试图(unified pool)
|
# 清理 ocr_debug_* 调试图(unified pool)
|
||||||
_clean_old_ocr_debug(script_dir, keep=60)
|
_clean_old_ocr_debug(script_dir, keep=6)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"[wechat] 调试截图保存失败: {e} (路径: {os.path.join(script_dir, 'ocr_debug_wx_*.png')})")
|
logger.warning(f"[wechat] 调试截图保存失败: {e} (路径: {os.path.join(script_dir, 'ocr_debug_wx_*.png')})")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user