feat(logging): enhance logging configuration and file handling
- Updated the maximum log file size to 10MB and reduced backup count to 5. - Introduced a `per_run` option to generate independent log files for each run. - Improved log file naming conventions based on the `per_run` setting. - Added support for both size-based and time-based log rotation configurations. - Implemented error handling for OCR click execution in `douyin_helpers.py`. - Added new CSV report for OCR regions and updated logging for click actions. - Introduced a temporary script to check logging configurations and handlers. - Added a new log file for unified logs dated 2025-12-27. - Updated reservations timestamp in JSON state file.
This commit is contained in:
1 parent
25ed50cc3c
commit
3d93f7f723
8 files changed
+486
-351
No files matched your search
@@ -253,11 +253,23 @@ class HelperFunctions:
|
||||
btn_x = int(532 * rx // 1080)
|
||||
btn_y = int(1289 * ry // 2400)
|
||||
|
||||
# 点击操作已被禁用:改为仅记录检测到结果并按配置切换/不切换
|
||||
analyser._log_kv( # type: ignore[attr-defined, reportPrivateUsage]
|
||||
"开奖结果", "点击已被禁用,使用OCR模式处理(未执行点击)", x=btn_x, y=btn_y
|
||||
)
|
||||
analyser.operation.delay(0.1)
|
||||
# OCR识别到结果,执行实际点击并等待生效
|
||||
try:
|
||||
HelperFunctions.click(analyser, btn_x, btn_y)
|
||||
analyser._log_kv( # type: ignore[attr-defined, reportPrivateUsage]
|
||||
"开奖结果", "已通过OCR执行点击", x=btn_x, y=btn_y
|
||||
)
|
||||
except Exception as e:
|
||||
analyser._log_kv( # type: ignore[attr-defined, reportPrivateUsage]
|
||||
"开奖结果", "OCR点击执行失败,继续后续处理", x=btn_x, y=btn_y, error=str(e)
|
||||
)
|
||||
|
||||
# 等待点击生效,优先使用配置项 fudai_click_wait_seconds 回退到 0.8 秒
|
||||
try:
|
||||
delay_sec = float(getattr(analyser, "fudai_click_wait_seconds", 0.8) or 0.8)
|
||||
except Exception:
|
||||
delay_sec = 0.8
|
||||
analyser.operation.delay(delay_sec)
|
||||
|
||||
# 切换下一个直播间
|
||||
try:
|
||||
|
||||
Reference in new issue
Block a user