diff --git a/docs/Git_连接与代理排查.md b/docs/Git_连接与代理排查.md new file mode 100644 index 0000000..b5427e1 --- /dev/null +++ b/docs/Git_连接与代理排查.md @@ -0,0 +1,79 @@ +# 附录:Git 连接与代理排查(常见问题与解决步骤) + +本仓库开发过程中,常见一个阻碍是本机或网络对 Git/HTTPS 访问的代理或防火墙配置。下面收集一套可重复的排查步骤与推荐配置,方便开发者快速恢复到“直连”状态或在需要时正确启用代理。 + +> 注意:下列命令在 Windows PowerShell 中执行;需要管理员权限的命令会在提示中标出。 + +## 1) 检查并移除 Git 层的代理配置(如存在) + +```powershell +git config --list --show-origin | Select-String -Pattern proxy || echo 'no git proxy' +git config --global --unset http.proxy +git config --global --unset https.proxy +git config --local --unset http.proxy +git config --local --unset https.proxy +``` + +## 2) 清理会话与用户级环境变量中的代理(PowerShell) + +```powershell +Remove-Item Env:HTTP_PROXY -ErrorAction SilentlyContinue +Remove-Item Env:HTTPS_PROXY -ErrorAction SilentlyContinue +[Environment]::SetEnvironmentVariable('HTTP_PROXY',$null,'User') +[Environment]::SetEnvironmentVariable('HTTPS_PROXY',$null,'User') +``` + +## 3) 重置系统 WinHTTP 代理(如果曾用 `netsh winhttp set proxy` 配置过) + +```powershell +# 需要管理员权限 +netsh winhttp reset proxy +``` + +## 4) 让 Git 使用 Windows 证书存储(避免 OpenSSL CA bundle 问题) + +```powershell +git config --global http.sslbackend schannel +#(可选)如果你有管理员权限并想设置系统级: +# git config --system http.sslbackend schannel +``` + +## 5) 测试连通性与 TLS(常用命令) + +```powershell +# 测试 TCP 层 +Test-NetConnection -ComputerName github.com -Port 443 -InformationLevel Detailed +# 路由追踪(可帮助定位在哪一跳被丢弃) +tracert github.com +# 使用 git 进行简单验证(不关闭 ssl 验证) +git -c http.sslVerify=true ls-remote https://github.com//.git +# 若需要更详细的网络调试,启用 trace +$env:GIT_CURL_VERBOSE=1; $env:GIT_TRACE=1; git ls-remote https://github.com//.git 2>&1 | Out-File git_lsremote_trace.txt +``` + +## 6) 常见现象与解释 + +- "Recv failure: Connection was reset": 常见于网络出口被中间设备重置连接,或本地代理未响应。排查步骤:先确认本机是否设置了代理(步骤1-3),再尝试切换网络(手机热点)或使用 VPN 以确认是否为网络出口限制。 +- TLS 证书验证失败(`unable to get local issuer certificate`):可能由 Git 使用的 OpenSSL CA bundle 缺失或路径错误导致。将 `http.sslbackend` 设置为 `schannel` 可让 Git 使用 Windows 系统证书,通常可解决。 + +## 7) 如果必须临时启用本地代理(仅用于不可直接访问场景) + +```powershell +# 假设本地代理监听 127.0.0.1:7890 +git config --global http.proxy http://127.0.0.1:7890 +git config --global https.proxy http://127.0.0.1:7890 +# 完成后测试并在不需要时移除 +``` + +## 8) 调试技巧与日志采集 + +- 在遇到间歇性连接复位时,先运行 `tracert` 定位丢包在哪一跳。 +- 使用 `GIT_TRACE=1 GIT_CURL_VERBOSE=1` 获取 git/curl 层面的 TLS 与 HTTP/2 交互日志(日志会包含请求头信息,注意不要泄露敏感凭证)。 + +## 9) 建议流程 + +如果你遇到无法直连的问题,按顺序执行上面 1 → 2 → 3 → 4 → 5;若仍然失败请把 `git_lsremote_trace.txt`(或 `git fetch` 的 trace 输出)贴来,我会帮助进一步分析 TLS/HTTP 阶段的错误。 + +--- + +*文件:docs/Git_连接与代理排查.md* diff --git a/docs/完整技术文档.md b/docs/完整技术文档.md index 41793d5..19d422d 100644 --- a/docs/完整技术文档.md +++ b/docs/完整技术文档.md @@ -13,355 +13,126 @@ - 2026-01-02: 补充快速开始、运行命令、重要环境变量与日志/调试图像说明。 - 统一整理关键裁剪区域坐标到 `douyin/fudai/core/coords.py` 并在 `douyin/stage/douyin_stage.py`、`douyin/fudai/douyin_fudai_core.py` 等模块引用常量,避免硬编码坐标。 -## 快速开始(最小可运行示例) +# 抖音福袋挂机 — 技术总览与 AI 指南 -1. 安装依赖(建议在虚拟环境中执行): +文档版本: V3.1 +最后更新: 2026-01-03 +目标读者: AI 助手、维护者、贡献者 -```bash -pip install -r requirements-minimal.txt -``` +目的:把项目的结构、运行方式、关键文件和可改进点明确化,使 AI 能快速定位问题、提出改进并自动化辅助修改。 -2. 连接设备并运行(示例): +## 目录(快速跳转) +- 概览与目标 +- 快速上手(运行与调试) +- 关键文件与模块地图 +- 核心流程与调用链(简明) +- 运行时状态与数据结构 +- 常见问题与排障步骤 +- AI 优化与改进建议(优先级与起手点) +- 给 AI 的具体任务清单(可自动执行的子任务) +- 开发与提交规范(精简) +- 附:常用命令 & 链接 -```bash -# 指定设备并允许切换直播间 -python run_cli.py --device_id --needswitch True -``` +## 概览与目标 +项目用途:在抖音直播中自动检测并参与“福袋”类抽奖,包含检测、筛选、参与、预约与开奖处理等流程。 +核心目标:可靠、低误报、高并发 OCR 效率、在多分辨率设备上稳定运行。 -3. 仅测试一次循环(方便调试): +## 快速上手(最小可运行) -```bash -python run_cli.py --device_id --needswitch False --wait_minutes 0 -``` +环境准备(推荐) +- Windows PowerShell: + - python -m venv .venv + - .\.venv\Scripts\Activate.ps1 +- pip install -r requirements-minimal.txt -## 重要路径与环境变量 +运行示例 +- 单设备启动主流程: + - python run_cli.py --device-id --needswitch +- 单次循环(调试): + - python run_cli.py --device-id --wait-minutes 0 -- 配置文件优先使用: `config/config.json`(通过 `path_config.get_config_path()` 获取)。 -- 路径工具: 统一使用 `path_config.py`,避免硬编码 `assets/`、`pic/`、`logs/`。 -- OCR 初始化: 默认优先 `EasyOCR`,失败回退 `PaddleOCR`;可通过环境变量 `SKIP_OCR_INIT=1` 跳过OCR初始化用于快速启动/调试。 -- 截图镜像: 为兼容性可能将截图镜像到外部目录,控制变量 `EXTERNAL_DOUYIN_FUDAI_DIR`;若不希望镜像,请设置 `DISABLE_SCREENSHOT_MIRROR=1`。 -- 日志初始化函数: `douyin/logging/douyin_logging.py:configure_logging()`,业务日志请使用 `analyser._log_kv(...)`(封装在 `douyin/logging/douyin_logging_wrapper.py`)。 +调试与日志 +- 日志入口:参见 [douyin/logging/douyin_logging.py](douyin/logging/douyin_logging.py),业务日志请使用 `analyser._log_kv(...)`。 +- 截图与调试图像控制:使用 `config/config.json` 中的 `debug_captures`,截图路径参见 `path_config.py`。 -## 【代码修改规范】 +## 关键文件与模块地图(AI 首次阅读建议顺序) -### 1. 缩进要求 +优先阅读(按重要性) +- [run_cli.py](run_cli.py) +- [douyin/core/douyin_fudai.py](douyin/core/douyin_fudai.py) +- [Underlying_Operations.py](Underlying_Operations.py) +- [douyin/fudai/douyin_fudai_core.py](douyin/fudai/douyin_fudai_core.py) +- [douyin/detection/douyin_pixel.py](douyin/detection/douyin_pixel.py) +- [douyin/reservation/douyin_reservation_logic.py](douyin/reservation/douyin_reservation_logic.py) +- [path_config.py](path_config.py) -- **严格使用4个空格**(不使用Tab) -- 确保所有代码块缩进层级正确 -- 保持与现有代码相同的缩进风格 +辅助参考 +- [config/config.json](config/config.json) +- [douyin/logging/douyin_logging_wrapper.py](douyin/logging/douyin_logging_wrapper.py) -### 2. 代码块完整性 +## 核心流程(简要调用链) +1) run_cli.py -> 创建 `fudai_analyse` -> load_config() -> fudai_choujiang() +2) fudai_choujiang -> 循环调用 run_once_basic() +3) run_once_basic:预约处理 -> 获取截图 -> 阶段诊断 -> 根据阶段执行(直播间/详情页/开奖结果) +4) 福袋详情页使用并行 OCR(ThreadPoolExecutor)解析价值/倒计时/按钮,并调用 `attend_choujiang()` 完成参与 -- **try 必须有对应的 except/finally** -- **if 的 else/elif 必须配对** -- **for/while 循环体必须正确缩进** -- **def/class 内部代码必须正确缩进** +## 运行时核心状态(AI 应关注) +- `_waiting_for_lottery_result`:是否在等待开奖结果 +- `reservations`(内存)与 `state/reservations.json`(持久化) +- `_last_successful_attend_ts`:最后成功参与时间(30 分钟保护) +- `_swipe_times`:滑动计数(重置策略触发) -### 3. 语法检查 +## 常见故障与排障步骤(可自动化检查项) +1) 截图失败:验证 `Underlying_Operations.get_screenshot()`,检查 `pic/screenshot.png` 文件存在与大小。 +2) OCR 识别失败:保存失败裁剪图到 `pic/ocr_failures/`,比对 EasyOCR/PaddleOCR 输出。 +3) 阶段误判:在 `douyin/detection/douyin_pixel.py` 中调整区域或阈值,并保存对比图。 -- 确保没有孤立的 except、else、elif -- 确保所有括号、引号配对 -- 确保所有冒号后都有正确的缩进块 +## 给 AI 的优化与改进建议(优先级起手点) +目标:提升稳定性与识别准确率。 -### 4. 修改流程 +高优先级 +- 强化截图可靠性:改进原子写入与 Windows 文件锁重试逻辑(`Underlying_Operations.get_screenshot`)。 +- 自动收集 OCR 失败样本并统计(便于训练/规则调整)。 -1. **先分析代码结构**,明确缩进层级 -2. **修改时保持缩进一致性** -3. **修改后验证语法正确性** +中优先级 +- 参数 A/B 测试:暴露阈值并自动化小范围调参(记录误报/漏报)。 +- 对 `extract_prize_value_yuan()` 增加更全面的正则测试用例。 -### 5. 验证清单 +可观测性 +- 在日志中增加 `traceId/device_id/stage/ocr_confidence/fudai_value`,便于聚合分析。 -- ✓ 缩进正确(4空格) -- ✓ 代码块完整(try/except配对等) -- ✓ 语法正确(无语法错误) -- ✓ 代码可运行(逻辑正确) +## 给 AI 的可执行任务清单(可自动在 CI/本地运行) +短期自动任务 +- 扫描仓库并列出所有“硬编码坐标/裁剪区域”位置(文件、行号)。 +- 运行 `python -m py_compile` 检查语法错误并输出清单。 +- 收集 `pic/` 中 OCR 失败样本并生成按区域统计报告。 + +中期任务(需人工复核) +- 生成阈值建议报告:在安全回放下试验阈值变化并记录效果。 +- 为关键解析函数添加单元测试样例(放在 tests/)。 + +长期计划(研究类) +- 使用小型图像分类器作为 OCR 与模板的二次验真器以降低误识率。 + +## 开发与提交规范(精简) +- 缩进:4 空格;异常建议捕获具体异常。 +- 提交流程:分支 `feature/`、`fix/`、`docs/`,PR 说明验证步骤与影响范围。 + +## 常用命令 +- 安装依赖:pip install -r requirements-minimal.txt +- 语法检查:python -m py_compile $(git ls-files "**/*.py") +- 运行一次:python run_cli.py --device-id --wait-minutes 0 + +## 后续建议 +- 逐步把“自动化收集样本 -> 生成报告 -> 生成 PR(小改动)”纳入 CI,AI 可以以此闭环优化识别规则。 + +文档变更记录 +- 2026-01-03: V3.1 — 重构并精简原文档,加入 AI 优化指南与可执行任务清单。 --- -## 开发约束与提交流程 +如果需要,我可以先运行“硬编码坐标扫描”并把结果放到 `tools/coords_report.csv`,或开始收集 OCR 失败样本。 -为保证代码质量与可维护性,请遵守以下约束与提交流程: - -- **代码风格与缩进**: 严格使用4个空格缩进(不使用Tab),遵循项目现有风格。 -- **异常处理**: `try` 必须配 `except` 或 `finally`,不要使用空的 `except:`,尽量捕获具体异常类型并记录或重抛。 -- **最小变更原则**: 修改时仅变更为实现目标所需的最小代码。避免不相关文件的大量重格式化。 -- **函数与方法接口**: 不随意修改公共函数签名,如确需变更应同步更新调用方与文档。 -- **配置与路径**: 不要硬编码路径,使用 `path_config.py` 提供的路径函数。 -- **测试与验证**: - - 修改后先在本地通过简单运行验证主流程: - -```bash -python run_cli.py --device-id --wait-minutes 0 -``` - - - 若修改涉及OCR/截图,可启用调试图像以验证裁剪区域: - -```bash -SKIP_OCR_INIT=1 python run_cli.py --device-id --needswitch -``` - - - 建议在 Windows 下运行 `python -m py_compile ` 或直接运行脚本以捕获语法错误。 -- **日志与调试**: 使用 `analyser._log_kv(...)` 记录业务日志,避免直接调用 `print()` 用于关键业务路径;调试时可保存截图并通过 `logs/actions.log` 追踪。 -- **提交规范**: - - 分支命名: `feature/<短描述>`、`fix/<短描述>` 或 `docs/<短描述>`。 - - 提交信息: 简洁说明修改目的、影响范围、验证步骤,例如: - -``` -feat: 优化福袋价值 OCR 区域 (修正坐标到 639,1466-769,1586) - -说明: 调整裁剪框以改善 OCR 识别率。 -验证: 本地运行 run_cli.py 并检查 pic/ 下裁剪图片与 logs/actions.log -``` - - - PR 描述: 包含变更摘要、影响文件列表、如何验证(步骤与期望结果)。 - - 不强制要求代码风格工具,但请保持代码整洁;如仓库新增格式化检查,请遵循。 -- **回滚与修复**: 如修改引入新问题,应先回滚到上一个稳定提交或提出快速修复 PR,并在 PR 中说明影响与回滚原因。 - -这些约束与流程用于日常开发与协作,保证代码可读性、可回溯性与稳定性。 - - -## 文档目标 - -本文档旨在为AI助手提供项目的完整技术理解,包括: - -- 项目整体架构和设计模式 -- **完整的流程图(含函数调用链)** -- **所有关键函数的详细说明(参数、返回值、作用、调用位置)** -- 模块结构和职责划分 -- 数据流和状态管理 -- 关键技术实现细节 -- 配置系统和扩展指南 - ---- - -## 目录 - -1. [项目概述](#1-项目概述) -2. [项目架构](#2-项目架构) -3. [完整流程图(含函数调用链)](#3-完整流程图含函数调用链) -4. [关键函数详细说明](#4-关键函数详细说明) -5. [其他重要函数](#5-其他重要函数) -6. [核心类和数据结构详解](#6-核心类和数据结构详解) -7. [配置系统详解](#7-配置系统详解) -8. [状态管理机制详解](#8-状态管理机制详解) -9. [错误处理和异常情况](#9-错误处理和异常情况) -10. [代码示例](#10-代码示例) -11. [模块详解](#11-模块详解) -12. [数据流和状态管理](#12-数据流和状态管理) -13. [关键技术实现](#13-关键技术实现) -14. [扩展指南和最佳实践](#14-扩展指南和最佳实践) -15. [关键文件索引和调试指南](#15-关键文件索引和调试指南) -16. [高级主题和深入理解](#16-高级主题和深入理解) -17. [预约验证和错误处理模块](#17-预约验证和错误处理模块) -18. [核心处理函数详解补充](#18-核心处理函数详解补充) -19. [工具函数和辅助模块详解](#19-工具函数和辅助模块详解) -20. [检测功能详解](#20-检测功能详解) -21. [导航和滑动操作详解](#21-导航和滑动操作详解) -22. [桌面检测和自救机制详解](#22-桌面检测和自救机制详解) -23. [日志系统详解](#23-日志系统详解) -24. [OCR预处理和优化详解](#24-ocr预处理和优化详解) -25. [路径配置系统详解](#25-路径配置系统详解) -26. [文本处理工具函数详解](#26-文本处理工具函数详解) - ---- - -## 1. 项目概述 - -### 1.1 项目简介 - -抖音福袋挂机项目是一个基于ADB(Android Debug Bridge)的自动化工具,用于在抖音直播间自动检测、筛选和参与福袋抽奖活动。项目采用Python开发,通过多种技术手段(OCR、像素检测、模板匹配)实现智能化的福袋处理流程。 - -### 1.2 核心功能 - -1. **自动检测福袋**: 在直播间自动检测福袋图标并打开详情页 -2. **智能筛选**: 根据价值、参与人数、倒计时、关键词等条件筛选福袋 -3. **自动参与**: 自动点击参与按钮,处理各种前置条件(加入粉丝团、评论等) -4. **高价值预约**: 自动记录高价值福袋,并在开奖前自动回退参与 -5. **开奖结果处理**: 自动检测开奖结果并领取奖品 -6. **直播间切换**: 支持自动切换直播间寻找更多福袋 -7. **状态管理**: 完善的预约、等待开奖、超时保护等状态管理机制 - -### 1.3 技术栈 - -- **Python 3.10+**: 主要开发语言 -- **ADB**: Android设备连接和控制 -- **PaddleOCR/EasyOCR**: OCR文字识别 -- **OpenCV**: 图像处理和模板匹配 -- **Pillow (PIL)**: 图像处理 -- **ThreadPoolExecutor**: 并行处理 -- **JSON**: 配置和状态存储 - -### 1.4 项目特点 - -- **模块化设计**: 采用Mixin模式,功能模块化,易于维护和扩展 -- **多分辨率支持**: 自动适配不同设备分辨率(基准1080x2400) -- **并行处理**: 使用线程池并行执行OCR任务,提高效率 -- **智能检测**: 结合像素检测、模板匹配、OCR多种技术,提高检测准确率 -- **完善的状态管理**: 预约、等待开奖、超时保护等机制 -- **详细的日志系统**: 统一的日志记录,便于调试和分析 - ---- - -## 2. 项目架构 - -### 2.1 整体架构 - -项目采用**模块化架构**,核心类 `fudai_analyse` 通过**Mixin模式**组合多个功能模块: - -``` -fudai_analyse (核心调度器) -├── NavigationMixin (导航功能) -├── StageDetectionMixin (阶段检测) -├── PopupHandlerMixin (弹窗处理) -├── LotteryResultMixin (抽奖结果) -├── RoomUtilsMixin (直播间工具) -└── MainLogicMixin (主逻辑) -``` - -### 2.2 目录结构 - -``` -douyin_guaji-main/ -├── douyin/ # 核心业务逻辑 -│ ├── core/ # 核心流程控制 -│ │ ├── douyin_fudai.py # 主类定义(Mixin组合) -│ │ ├── douyin_flow_control.py # 流程控制 -│ │ └── fudai_modules/ # Mixin模块 -│ ├── stage/ # 阶段诊断 -│ ├── detection/ # 检测模块(像素、模板) -│ ├── fudai/ # 福袋处理 -│ ├── reservation/ # 预约逻辑 -│ ├── handlers/ # 各种处理器 -│ ├── logging/ # 日志系统 -│ └── utils/ # 工具函数 -├── operations/ # 底层操作封装 -│ ├── device_operations.py # 设备操作 -│ ├── screenshot_operations.py # 截图操作 -│ ├── ocr_operations.py # OCR操作 -│ └── image_operations.py # 图像处理 -├── gui/ # GUI界面 -│ ├── gui_app.py # Tkinter GUI -│ └── web_gui.py # Web GUI -├── config/ # 配置文件 -│ └── config.json # 主配置文件 -├── state/ # 状态文件 -│ ├── reservations.json # 预约数据 -│ └── high_value_rooms.json # 高价值直播间 -├── logs/ # 日志文件 -├── pic/ # 截图和临时图片 -├── assets/ # 模板图片 -├── run_cli.py # CLI入口 -├── Underlying_Operations.py # 底层操作类(兼容) -└── path_config.py # 路径配置 -``` - -### 2.3 设计模式 - -#### 2.3.1 Mixin模式 - -核心类 `fudai_analyse` 通过多重继承组合多个Mixin类,每个Mixin负责特定功能: - -```python -class fudai_analyse( - NavigationMixin, # 导航功能 - StageDetectionMixin, # 阶段检测 - PopupHandlerMixin, # 弹窗处理 - LotteryResultMixin, # 抽奖结果 - RoomUtilsMixin, # 直播间工具 - MainLogicMixin, # 主逻辑 -): - """福袋抽奖相关操作类""" -``` - -**优势**: -- 功能模块化,职责清晰 -- 易于扩展和维护 -- 避免单文件过大 - -#### 2.3.2 回调函数模式 - -流程控制函数使用回调函数模式,提高灵活性: - -```python -def handle_no_fudai_situation( - analyser, - swipe_up_switch_callback, # 上滑切换回调 - swipe_down_back_callback, # 下滑回退回调 - seek_reservation_room_callback, # 查找预约直播间回调 - ... -): - # 使用回调函数执行具体操作 -``` - -#### 2.3.3 状态管理模式 - -使用JSON文件持久化状态,内存中维护运行时状态: - -- **持久化状态**: `state/reservations.json` - 预约数据 -- **运行时状态**: `fudai_analyse` 类的属性 - 等待开奖、滑动次数等 - ---- - -## 3. 完整流程图(含函数调用链) - -### 3.1 程序启动流程 - -```javascript -run_cli.py::main(argv) - ↓ -[解析命令行参数] - ├─> parse_args(argv) - └─> 创建 fudai_analyse 对象 - ↓ -fudai_analyse.__init__() - ├─> 初始化设备属性 - ├─> 初始化底层操作对象 (underlying_operations) - ├─> 初始化日志系统 - └─> 初始化状态管理属性 - ↓ -fudai_analyse.fudai_choujiang(device_id, y_pianyi, needswitch, wait_minutes) - ├─> 设置设备ID和分辨率 - ├─> 加载配置 (load_config) - └─> 进入无限循环 - └─> fudai_analyse.run_once_basic() [循环调用] -``` - -#### 运行与常用命令 - -- 启动并允许自动切换直播间(常用): - -```bash -python run_cli.py --device-id --needswitch -``` - -- 指定最小参与价值并限制运行时长(示例): - -```bash -python run_cli.py --device-id --min-prize-value-yuan 300 --wait-minutes 60 -``` - -- 常用命令行覆盖项(摘要): - - `--device-id`: ADB 设备 ID,空则自动选择。 - - `--y-pianyi`: Y 轴偏移(整数,±数十范围)。 - - `--needswitch`: 启用上划切换直播间(布尔开关,使用时传入即可)。 - - `--wait-minutes`: 运行时长(分钟),0或负表示无限运行。 - - `--min-prize-value-yuan`, `--min-participants`, `--max-participants`: 运行时覆盖筛选阈值。 - - 预约/回退相关:`--reservation-back-verify-enabled/--disabled`, `--reservation-back-swipe-delay`。 - - 高价值回访:`--high-value-room-revisit-enabled/--disabled`、`--high-value-room-revisit-only-current-run`。 - - OCR/模板开关:`--enable-ocr-mode1` / `--disable-ocr-mode1`、`--fudai-template-enabled/--disabled`、`--fudai-template-threshold`。 - -请优先通过 `config/config.json` 配置常用选项,命令行参数仅用作临时覆盖或 GUI 启动时的快速覆盖(命令行优先级高于配置文件)。 - - -**关键函数说明**: - -- `run_cli.py::main()`: 命令行入口,解析参数并创建分析器对象 -- `fudai_analyse.__init__()`: 初始化所有核心属性 -- `fudai_analyse.fudai_choujiang()`: 主循环入口,启动无限循环 - ---- - -### 3.2 单次循环完整流程 (`run_once_basic`) ```javascript run_once_basic(recursion_depth=0) diff --git a/douyin/core/state/reservations.json b/douyin/core/state/reservations.json index a10b835..4dba3df 100644 --- a/douyin/core/state/reservations.json +++ b/douyin/core/state/reservations.json @@ -1,5 +1,5 @@ { - "updated_ts": 1767369418.118446, + "updated_ts": 1767373375.3158991, "reason": "startup_clear", "room_pos": 0, "current_room_title": "", diff --git a/douyin/logging/douyin_logging.py b/douyin/logging/douyin_logging.py index 5c0e2ee..a1de7b0 100644 --- a/douyin/logging/douyin_logging.py +++ b/douyin/logging/douyin_logging.py @@ -55,8 +55,9 @@ class RotatingDatedFileHandler(logging.FileHandler): self, base_filename: str, date_format: str = "%Y-%m-%d", - max_bytes: int = 100 * 1024 * 1024, # 100MB - backup_count: int = 10, # 同一日期内最多保留的文件数 + max_bytes: int = 10 * 1024 * 1024, # 10MB + backup_count: int = 5, # 同一日期内最多保留的文件数 + per_run: bool = False, # 是否为每次运行生成独立文件(包含运行时间戳) encoding: str = "utf-8-sig", mode: str = "a", errors: str = "replace", @@ -82,6 +83,7 @@ class RotatingDatedFileHandler(logging.FileHandler): self.current_date = datetime.now().strftime(date_format) self.current_filename = self._get_filename_for_date(self.current_date) self.current_sequence = 0 # 当前文件序号 + self.per_run = per_run # 确保目录存在 log_dir = os.path.dirname(self.current_filename) @@ -101,10 +103,17 @@ class RotatingDatedFileHandler(logging.FileHandler): def _get_filename_for_date(self, date_str: str, sequence: int = 0) -> str: """根据日期和序号生成文件名""" - if sequence == 0: - return f"{self.base_filename}_{date_str}.log" + if self.per_run: + # 每次运行的文件名不再包含额外的日期字段(base_filename 已带运行时间戳) + if sequence == 0: + return f"{self.base_filename}.log" + else: + return f"{self.base_filename}.{sequence}.log" else: - return f"{self.base_filename}_{date_str}.{sequence}.log" + if sequence == 0: + return f"{self.base_filename}_{date_str}.log" + else: + return f"{self.base_filename}_{date_str}.{sequence}.log" def _get_next_filename(self, date_str: str) -> str: """获取下一个可用的文件名""" @@ -171,8 +180,8 @@ class RotatingDatedFileHandler(logging.FileHandler): today = datetime.now().strftime(self.date_format) self._last_date_check_time = datetime.now() - if today != self.current_date: - # 日期变化,轮转到新日期 + if not self.per_run and today != self.current_date: + # 日期变化,轮转到新日期(per_run 模式下不按日期轮转) self.close() self.current_date = today self.current_filename = self._get_filename_for_date(self.current_date) @@ -434,8 +443,8 @@ def get_logger(name: Optional[str] = None) -> logging.Logger: def configure_logging( log_level: Optional[str] = None, log_file: Optional[str] = None, - max_bytes: int = 100 * 1024 * 1024, # 100MB - backup_count: int = 10, # 同一日期内保留的文件数 + max_bytes: int = 10 * 1024 * 1024, # 10MB + backup_count: int = 5, # 同一日期内保留的文件数 enable_console: bool = True, enable_file: bool = True, keep_days: Optional[int] = None, # 保留日志天数 @@ -497,6 +506,19 @@ def configure_logging( max_total_size_gb = log_config.get("max_total_size_gb", 10.0) if compress_after_days == 7: # 如果是默认值,从配置读取 compress_after_days = log_config.get("compress_after_days", 7) + + # 读取 rotation 配置(优先级高于函数默认参数) + rotation_cfg = log_config.get("rotation", {}) if isinstance(log_config, dict) else {} + rotation_enabled = rotation_cfg.get("enabled", True) + if rotation_cfg: + # 支持按大小与按时间的配置 + max_bytes = rotation_cfg.get("max_bytes", max_bytes) + backup_count = rotation_cfg.get("backup_count", backup_count) + rotation_when = rotation_cfg.get("when") + rotation_interval = rotation_cfg.get("interval", 1) + else: + rotation_when = None + rotation_interval = 1 except Exception: if log_level is None: log_level = "INFO" @@ -509,6 +531,11 @@ def configure_logging( if compress_logs is None: compress_logs = True + # rotation 默认值(当读取 config 出错时) + rotation_when = None + rotation_interval = 1 + rotation_enabled = False + # 规范化日志级别 if log_level is None: log_level = "INFO" @@ -561,6 +588,19 @@ def configure_logging( os.makedirs(log_dir, exist_ok=True) # 使用增强的轮转Handler + # 支持每次运行生成独立文件(per_run):在 base_filename 后追加运行时间戳,并在 handler 中关闭日期轮转 + per_run = False + try: + per_run = bool(log_config.get("per_run", True)) if isinstance(log_config, dict) else True + except Exception: + per_run = True + + # base_filename_base: 不带运行时间戳/扩展名的基础名,用于清理和监控 + base_filename_base = base_filename + if per_run: + run_ts = datetime.now().strftime("%Y-%m-%d_%H%M%S") + base_filename = f"{base_filename_base}_{run_ts}" + file_handler = RotatingDatedFileHandler( base_filename, date_format="%Y-%m-%d", @@ -570,13 +610,14 @@ def configure_logging( mode="a", errors="replace", compress_old=compress_logs if compress_logs is not None else True, + per_run=per_run, ) - # 启动时清理旧日志 + # 启动时清理旧日志:始终以基础 base 名(不含运行时间戳)作为匹配前缀 if keep_days is not None: cleanup_old_logs( log_dir or path_config.get_logs_dir(), - os.path.basename(base_filename), + os.path.basename(base_filename_base), keep_days=keep_days, max_total_size_gb=max_total_size_gb, compress_after_days=compress_after_days, @@ -588,7 +629,7 @@ def configure_logging( try: start_log_monitor( logs_dir=log_dir or path_config.get_logs_dir(), - base_name=os.path.basename(base_filename), + base_name=os.path.basename(base_filename_base), warning_size_mb=monitor_warning_mb, critical_size_mb=monitor_critical_mb, ) @@ -605,13 +646,34 @@ def configure_logging( if log_dir: os.makedirs(log_dir, exist_ok=True) - file_handler = logging.handlers.RotatingFileHandler( - log_file, # type: ignore[arg-type] - maxBytes=max_bytes, - backupCount=backup_count, - encoding="utf-8-sig", - errors="replace", - ) + # 如果配置了按时间轮转(when),使用 TimedRotatingFileHandler + try: + if rotation_enabled and rotation_when: + file_handler = logging.handlers.TimedRotatingFileHandler( + log_file, + when=rotation_when, + interval=rotation_interval, + backupCount=backup_count, + encoding="utf-8-sig", + errors="replace", + ) + else: + file_handler = logging.handlers.RotatingFileHandler( + log_file, # type: ignore[arg-type] + maxBytes=max_bytes, + backupCount=backup_count, + encoding="utf-8-sig", + errors="replace", + ) + except Exception: + # 回退到大小轮转 + file_handler = logging.handlers.RotatingFileHandler( + log_file, # type: ignore[arg-type] + maxBytes=max_bytes, + backupCount=backup_count, + encoding="utf-8-sig", + errors="replace", + ) file_handler.setLevel(numeric_level) # 使用自定义Formatter以支持traceId diff --git a/douyin/utils/douyin_helpers.py b/douyin/utils/douyin_helpers.py index 5af8d51..3fa05c7 100644 --- a/douyin/utils/douyin_helpers.py +++ b/douyin/utils/douyin_helpers.py @@ -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: diff --git a/git_lsremote_trace.txt b/git_lsremote_trace.txt new file mode 100644 index 0000000..eb66ba0 --- /dev/null +++ b/git_lsremote_trace.txt @@ -0,0 +1,191 @@ +00:13:44.963131 exec-cmd.c:244 trace: resolved executable dir: D:/Git/mingw64/bin +00:13:44.992482 git.c:463 trace: built-in: git ls-remote https://github.com/Zzzil/douyin_guaji-main.git +00:13:44.995001 run-command.c:659 trace: run_command: GIT_DIR=.git git remote-https https://github.com/Zzzil/douyin_guaji-main.git https://github.com/Zzzil/douyin_guaji-main.git +00:13:45.039988 exec-cmd.c:244 trace: resolved executable dir: D:/Git/mingw64/libexec/git-core +00:13:45.068497 git.c:749 trace: exec: git-remote-https https://github.com/Zzzil/douyin_guaji-main.git https://github.com/Zzzil/douyin_guaji-main.git +00:13:45.068497 run-command.c:659 trace: run_command: git-remote-https https://github.com/Zzzil/douyin_guaji-main.git https://github.com/Zzzil/douyin_guaji-main.git +00:13:45.113375 exec-cmd.c:244 trace: resolved executable dir: D:/Git/mingw64/libexec/git-core +00:13:45.158944 http.c:870 == Info: Couldn't find host github.com in the .netrc file; using defaults +00:13:45.182592 http.c:870 == Info: Trying 20.205.243.166:443... +00:13:45.395151 http.c:870 == Info: Connected to github.com (20.205.243.166) port 443 +00:13:45.396159 http.c:870 == Info: ALPN: curl offers h2,http/1.1 +00:13:45.396159 http.c:870 == Info: TLSv1.3 (OUT), TLS handshake, Client hello (1): +00:13:45.608239 http.c:870 == Info: TLSv1.3 (IN), TLS handshake, Server hello (2): +00:13:45.608239 http.c:870 == Info: TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8): +00:13:45.608239 http.c:870 == Info: TLSv1.3 (IN), TLS handshake, Certificate (11): +00:13:45.609245 http.c:870 == Info: TLSv1.3 (IN), TLS handshake, CERT verify (15): +00:13:45.609245 http.c:870 == Info: TLSv1.3 (IN), TLS handshake, Finished (20): +00:13:45.609245 http.c:870 == Info: TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1): +00:13:45.609245 http.c:870 == Info: TLSv1.3 (OUT), TLS handshake, Finished (20): +00:13:45.609245 http.c:870 == Info: SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256 +00:13:45.609245 http.c:870 == Info: ALPN: server accepted h2 +00:13:45.609245 http.c:870 == Info: Server certificate: +00:13:45.609245 http.c:870 == Info: subject: CN=github.com +00:13:45.609245 http.c:870 == Info: start date: Feb 5 00:00:00 2025 GMT +00:13:45.609245 http.c:870 == Info: expire date: Feb 5 23:59:59 2026 GMT +00:13:45.609245 http.c:870 == Info: issuer: C=GB; ST=Greater Manchester; L=Salford; O=Sectigo Limited; CN=Sectigo ECC Domain Validation Secure Server CA +00:13:45.609245 http.c:870 == Info: SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway. +00:13:45.609245 http.c:870 == Info: using HTTP/2 +00:13:45.610248 http.c:870 == Info: [HTTP/2] [1] OPENED stream for https://github.com/Zzzil/douyin_guaji-main.git/info/refs?service=git-upload-pack +00:13:45.610248 http.c:870 == Info: [HTTP/2] [1] [:method: GET] +00:13:45.610248 http.c:870 == Info: [HTTP/2] [1] [:scheme: https] +00:13:45.610248 http.c:870 == Info: [HTTP/2] [1] [:authority: github.com] +00:13:45.610248 http.c:870 == Info: [HTTP/2] [1] [:path: /Zzzil/douyin_guaji-main.git/info/refs?service=git-upload-pack] +00:13:45.610248 http.c:870 == Info: [HTTP/2] [1] [user-agent: git/2.43.0.windows.1] +00:13:45.610248 http.c:870 == Info: [HTTP/2] [1] [accept: */*] +00:13:45.610248 http.c:870 == Info: [HTTP/2] [1] [accept-encoding: deflate, gzip, br, zstd] +00:13:45.610248 http.c:870 == Info: [HTTP/2] [1] [pragma: no-cache] +00:13:45.610248 http.c:870 == Info: [HTTP/2] [1] [git-protocol: version=2] +00:13:45.610248 http.c:817 => Send header, 0000000227 bytes (0x000000e3) +00:13:45.610248 http.c:829 => Send header: GET /Zzzil/douyin_guaji-main.git/info/refs?service=git-upload-pack HTTP/2 +00:13:45.610248 http.c:829 => Send header: Host: github.com +00:13:45.610248 http.c:829 => Send header: User-Agent: git/2.43.0.windows.1 +00:13:45.610248 http.c:829 => Send header: Accept: */* +00:13:45.610248 http.c:829 => Send header: Accept-Encoding: deflate, gzip, br, zstd +00:13:45.610248 http.c:829 => Send header: Pragma: no-cache +00:13:45.610248 http.c:829 => Send header: Git-Protocol: version=2 +00:13:45.610248 http.c:829 => Send header: +00:13:45.819399 http.c:870 == Info: TLSv1.3 (IN), TLS handshake, Newsession Ticket (4): +00:13:45.820411 http.c:870 == Info: TLSv1.3 (IN), TLS handshake, Newsession Ticket (4): +00:13:45.820411 http.c:870 == Info: old SSL session ID is stale, removing +00:13:46.487098 http.c:817 <= Recv header, 0000000013 bytes (0x0000000d) +00:13:46.487098 http.c:829 <= Recv header: HTTP/2 401 +00:13:46.487098 http.c:817 <= Recv header, 0000000026 bytes (0x0000001a) +00:13:46.487098 http.c:829 <= Recv header: server: GitHub-Babel/3.0 +00:13:46.487098 http.c:817 <= Recv header, 0000000054 bytes (0x00000036) +00:13:46.487098 http.c:829 <= Recv header: content-security-policy: default-src 'none'; sandbox +00:13:46.487098 http.c:817 <= Recv header, 0000000041 bytes (0x00000029) +00:13:46.487098 http.c:829 <= Recv header: content-type: text/plain; charset=UTF-8 +00:13:46.487098 http.c:817 <= Recv header, 0000000040 bytes (0x00000028) +00:13:46.487098 http.c:829 <= Recv header: www-authenticate: Basic realm="GitHub" +00:13:46.487098 http.c:817 <= Recv header, 0000000020 bytes (0x00000014) +00:13:46.487098 http.c:829 <= Recv header: content-length: 21 +00:13:46.487098 http.c:817 <= Recv header, 0000000037 bytes (0x00000025) +00:13:46.487098 http.c:829 <= Recv header: date: Fri, 02 Jan 2026 16:13:56 GMT +00:13:46.487098 http.c:817 <= Recv header, 0000000023 bytes (0x00000017) +00:13:46.487098 http.c:829 <= Recv header: x-frame-options: DENY +00:13:46.487098 http.c:817 <= Recv header, 0000000073 bytes (0x00000049) +00:13:46.487098 http.c:829 <= Recv header: strict-transport-security: max-age=31536000; includeSubDomains; preload +00:13:46.487098 http.c:817 <= Recv header, 0000000058 bytes (0x0000003a) +00:13:46.487098 http.c:829 <= Recv header: x-github-request-id: 6140:1AF3F5:EAAEE6:107B593:6957EEC4 +00:13:46.487098 http.c:817 <= Recv header, 0000000002 bytes (0x00000002) +00:13:46.487098 http.c:829 <= Recv header: +00:13:46.487098 http.c:870 == Info: Connection #0 to host github.com left intact +00:13:46.487098 run-command.c:659 trace: run_command: 'git credential-manager get' +00:13:46.595677 exec-cmd.c:244 trace: resolved executable dir: D:/Git/mingw64/libexec/git-core +00:13:46.620240 git.c:749 trace: exec: git-credential-manager get +00:13:46.620240 run-command.c:659 trace: run_command: git-credential-manager get +00:13:46.758400 exec-cmd.c:244 trace: resolved executable dir: D:/Git/mingw64/libexec/git-core +00:13:46.781659 git.c:463 trace: built-in: git config --null --list +00:13:46.953492 http.c:870 == Info: Found bundle for host: 0x15eb41eb110 [can multiplex] +00:13:46.953492 http.c:870 == Info: Re-using existing connection with host github.com +00:13:46.953492 http.c:870 == Info: Server auth using Basic with user 'Zzzil' +00:13:46.953492 http.c:870 == Info: [HTTP/2] [3] OPENED stream for https://github.com/Zzzil/douyin_guaji-main.git/info/refs?service=git-upload-pack +00:13:46.953492 http.c:870 == Info: [HTTP/2] [3] [:method: GET] +00:13:46.953492 http.c:870 == Info: [HTTP/2] [3] [:scheme: https] +00:13:46.953492 http.c:870 == Info: [HTTP/2] [3] [:authority: github.com] +00:13:46.953492 http.c:870 == Info: [HTTP/2] [3] [:path: /Zzzil/douyin_guaji-main.git/info/refs?service=git-upload-pack] +00:13:46.953492 http.c:870 == Info: [HTTP/2] [3] [authorization: Basic ] +00:13:46.953492 http.c:870 == Info: [HTTP/2] [3] [user-agent: git/2.43.0.windows.1] +00:13:46.953492 http.c:870 == Info: [HTTP/2] [3] [accept: */*] +00:13:46.953492 http.c:870 == Info: [HTTP/2] [3] [accept-encoding: deflate, gzip, br, zstd] +00:13:46.953492 http.c:870 == Info: [HTTP/2] [3] [pragma: no-cache] +00:13:46.953492 http.c:870 == Info: [HTTP/2] [3] [git-protocol: version=2] +00:13:46.953492 http.c:817 => Send header, 0000000314 bytes (0x0000013a) +00:13:46.953492 http.c:829 => Send header: GET /Zzzil/douyin_guaji-main.git/info/refs?service=git-upload-pack HTTP/2 +00:13:46.953492 http.c:829 => Send header: Host: github.com +00:13:46.953492 http.c:829 => Send header: Authorization: Basic +00:13:46.953492 http.c:829 => Send header: User-Agent: git/2.43.0.windows.1 +00:13:46.953492 http.c:829 => Send header: Accept: */* +00:13:46.953492 http.c:829 => Send header: Accept-Encoding: deflate, gzip, br, zstd +00:13:46.953492 http.c:829 => Send header: Pragma: no-cache +00:13:46.953492 http.c:829 => Send header: Git-Protocol: version=2 +00:13:46.953492 http.c:829 => Send header: +00:13:47.425703 http.c:817 <= Recv header, 0000000013 bytes (0x0000000d) +00:13:47.425703 http.c:829 <= Recv header: HTTP/2 200 +00:13:47.425703 http.c:817 <= Recv header, 0000000026 bytes (0x0000001a) +00:13:47.425703 http.c:829 <= Recv header: server: GitHub-Babel/3.0 +00:13:47.425703 http.c:817 <= Recv header, 0000000059 bytes (0x0000003b) +00:13:47.425703 http.c:829 <= Recv header: content-type: application/x-git-upload-pack-advertisement +00:13:47.425703 http.c:817 <= Recv header, 0000000054 bytes (0x00000036) +00:13:47.425703 http.c:829 <= Recv header: content-security-policy: default-src 'none'; sandbox +00:13:47.425703 http.c:817 <= Recv header, 0000000040 bytes (0x00000028) +00:13:47.425703 http.c:829 <= Recv header: expires: Fri, 01 Jan 1980 00:00:00 GMT +00:13:47.425703 http.c:817 <= Recv header, 0000000018 bytes (0x00000012) +00:13:47.425703 http.c:829 <= Recv header: pragma: no-cache +00:13:47.425703 http.c:817 <= Recv header, 0000000053 bytes (0x00000035) +00:13:47.425703 http.c:829 <= Recv header: cache-control: no-cache, max-age=0, must-revalidate +00:13:47.425703 http.c:817 <= Recv header, 0000000023 bytes (0x00000017) +00:13:47.425703 http.c:829 <= Recv header: vary: Accept-Encoding +00:13:47.425703 http.c:817 <= Recv header, 0000000037 bytes (0x00000025) +00:13:47.425703 http.c:829 <= Recv header: date: Fri, 02 Jan 2026 16:13:57 GMT +00:13:47.425703 http.c:817 <= Recv header, 0000000023 bytes (0x00000017) +00:13:47.425703 http.c:829 <= Recv header: x-frame-options: DENY +00:13:47.425703 http.c:817 <= Recv header, 0000000073 bytes (0x00000049) +00:13:47.425703 http.c:829 <= Recv header: strict-transport-security: max-age=31536000; includeSubDomains; preload +00:13:47.425703 http.c:817 <= Recv header, 0000000058 bytes (0x0000003a) +00:13:47.425703 http.c:829 <= Recv header: x-github-request-id: 6140:1AF3F5:EAB00F:107B6CE:6957EEC4 +00:13:47.425703 http.c:817 <= Recv header, 0000000002 bytes (0x00000002) +00:13:47.425703 http.c:829 <= Recv header: +00:13:47.425703 http.c:870 == Info: Connection #0 to host github.com left intact +00:13:47.425703 run-command.c:659 trace: run_command: 'git credential-manager store' +00:13:47.524651 exec-cmd.c:244 trace: resolved executable dir: D:/Git/mingw64/libexec/git-core +00:13:47.546842 git.c:749 trace: exec: git-credential-manager store +00:13:47.546842 run-command.c:659 trace: run_command: git-credential-manager store +00:13:47.661941 exec-cmd.c:244 trace: resolved executable dir: D:/Git/mingw64/libexec/git-core +00:13:47.685091 git.c:463 trace: built-in: git config --null --list +00:13:47.828028 http.c:870 == Info: Found bundle for host: 0x15eb41eb110 [can multiplex] +00:13:47.828028 http.c:870 == Info: Re-using existing connection with host github.com +00:13:47.828028 http.c:870 == Info: Server auth using Basic with user 'Zzzil' +00:13:47.828028 http.c:870 == Info: [HTTP/2] [5] OPENED stream for https://github.com/Zzzil/douyin_guaji-main.git/git-upload-pack +00:13:47.828028 http.c:870 == Info: [HTTP/2] [5] [:method: POST] +00:13:47.828028 http.c:870 == Info: [HTTP/2] [5] [:scheme: https] +00:13:47.828028 http.c:870 == Info: [HTTP/2] [5] [:authority: github.com] +00:13:47.828028 http.c:870 == Info: [HTTP/2] [5] [:path: /Zzzil/douyin_guaji-main.git/git-upload-pack] +00:13:47.828028 http.c:870 == Info: [HTTP/2] [5] [authorization: Basic ] +00:13:47.828028 http.c:870 == Info: [HTTP/2] [5] [user-agent: git/2.43.0.windows.1] +00:13:47.828028 http.c:870 == Info: [HTTP/2] [5] [accept-encoding: deflate, gzip, br, zstd] +00:13:47.828028 http.c:870 == Info: [HTTP/2] [5] [content-type: application/x-git-upload-pack-request] +00:13:47.828028 http.c:870 == Info: [HTTP/2] [5] [accept: application/x-git-upload-pack-result] +00:13:47.828028 http.c:870 == Info: [HTTP/2] [5] [git-protocol: version=2] +00:13:47.828028 http.c:870 == Info: [HTTP/2] [5] [content-length: 112] +00:13:47.828028 http.c:817 => Send header, 0000000386 bytes (0x00000182) +00:13:47.828028 http.c:829 => Send header: POST /Zzzil/douyin_guaji-main.git/git-upload-pack HTTP/2 +00:13:47.828028 http.c:829 => Send header: Host: github.com +00:13:47.828028 http.c:829 => Send header: Authorization: Basic +00:13:47.828028 http.c:829 => Send header: User-Agent: git/2.43.0.windows.1 +00:13:47.828028 http.c:829 => Send header: Accept-Encoding: deflate, gzip, br, zstd +00:13:47.828028 http.c:829 => Send header: Content-Type: application/x-git-upload-pack-request +00:13:47.828028 http.c:829 => Send header: Accept: application/x-git-upload-pack-result +00:13:47.828028 http.c:829 => Send header: Git-Protocol: version=2 +00:13:47.828028 http.c:829 => Send header: Content-Length: 112 +00:13:47.828028 http.c:829 => Send header: +00:13:48.291956 http.c:817 <= Recv header, 0000000013 bytes (0x0000000d) +00:13:48.291956 http.c:829 <= Recv header: HTTP/2 200 +00:13:48.291956 http.c:817 <= Recv header, 0000000026 bytes (0x0000001a) +00:13:48.291956 http.c:829 <= Recv header: server: GitHub-Babel/3.0 +00:13:48.291956 http.c:817 <= Recv header, 0000000052 bytes (0x00000034) +00:13:48.291956 http.c:829 <= Recv header: content-type: application/x-git-upload-pack-result +00:13:48.291956 http.c:817 <= Recv header, 0000000054 bytes (0x00000036) +00:13:48.291956 http.c:829 <= Recv header: content-security-policy: default-src 'none'; sandbox +00:13:48.291956 http.c:817 <= Recv header, 0000000040 bytes (0x00000028) +00:13:48.291956 http.c:829 <= Recv header: expires: Fri, 01 Jan 1980 00:00:00 GMT +00:13:48.291956 http.c:817 <= Recv header, 0000000018 bytes (0x00000012) +00:13:48.291956 http.c:829 <= Recv header: pragma: no-cache +00:13:48.291956 http.c:817 <= Recv header, 0000000053 bytes (0x00000035) +00:13:48.291956 http.c:829 <= Recv header: cache-control: no-cache, max-age=0, must-revalidate +00:13:48.291956 http.c:817 <= Recv header, 0000000023 bytes (0x00000017) +00:13:48.291956 http.c:829 <= Recv header: vary: Accept-Encoding +00:13:48.291956 http.c:817 <= Recv header, 0000000037 bytes (0x00000025) +00:13:48.291956 http.c:829 <= Recv header: date: Fri, 02 Jan 2026 16:13:58 GMT +00:13:48.291956 http.c:817 <= Recv header, 0000000023 bytes (0x00000017) +00:13:48.291956 http.c:829 <= Recv header: x-frame-options: DENY +00:13:48.291956 http.c:817 <= Recv header, 0000000073 bytes (0x00000049) +00:13:48.291956 http.c:829 <= Recv header: strict-transport-security: max-age=31536000; includeSubDomains; preload +00:13:48.291956 http.c:817 <= Recv header, 0000000058 bytes (0x0000003a) +00:13:48.291956 http.c:829 <= Recv header: x-github-request-id: 6140:1AF3F5:EAB0D6:107B7A3:6957EEC5 +00:13:48.291956 http.c:817 <= Recv header, 0000000002 bytes (0x00000002) +00:13:48.291956 http.c:829 <= Recv header: +00:13:48.291956 http.c:870 == Info: Connection #0 to host github.com left intact +a079149c80c390dcbcb9d40cba611bc7e7b7be2d HEAD +a079149c80c390dcbcb9d40cba611bc7e7b7be2d refs/heads/main diff --git a/logs/unified_2025-12-27.log.gz b/logs/unified_2025-12-27.log.gz new file mode 100644 index 0000000..724eb67 Binary files /dev/null and b/logs/unified_2025-12-27.log.gz differ diff --git a/tools/tmp_check_logging.py b/tools/tmp_check_logging.py new file mode 100644 index 0000000..65a5fbb --- /dev/null +++ b/tools/tmp_check_logging.py @@ -0,0 +1,20 @@ +from douyin.logging import douyin_logging +import logging +import logging.handlers as lh + +# Configure logging using current config +douyin_logging.configure_logging() +root = logging.getLogger() +print('handlers:', [type(h).__name__ for h in root.handlers]) + +for h in root.handlers: + fname = getattr(h, 'baseFilename', getattr(h, 'filename', None)) + print(type(h).__name__, fname) + # RotatingDatedFileHandler specific + if hasattr(h, 'max_bytes'): + print(' max_bytes =', getattr(h, 'max_bytes', None), 'backup_count =', getattr(h, 'backup_count', None)) + # RotatingFileHandler + if isinstance(h, lh.RotatingFileHandler): + print(' RotatingFileHandler maxBytes =', getattr(h, 'maxBytes', None), 'backupCount =', getattr(h, 'backupCount', None)) + if isinstance(h, lh.TimedRotatingFileHandler): + print(' TimedRotating when =', getattr(h, 'when', None), 'interval =', getattr(h, 'interval', None), 'backupCount =', getattr(h, 'backupCount', None))