Repository navigation
🐛 修复日志定时清理并统一后台业务日志记录 - #1599
Merged
Merged
Conversation
CodFrm
force-pushed
the
fix/log-auto-cleanup
branch
from
July 17, 2026 07:56
fe00985 to
1cc3344
Compare
CodFrm
force-pushed
the
fix/log-auto-cleanup
branch
from
July 17, 2026 08:05
1cc3344 to
6343e99
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist / 检查清单
Description / 描述
问题
Manifest V3 重构后,日志页面仍可配置“定时清理 n 天前的日志”,
log_clean_cycle配置和LoggerDAO.deleteBefore()也仍然存在,但原有定时触发逻辑没有迁移,导致该功能只保存配置而不会真正清理日志。同时,Service Worker 中部分可供用户排查的业务异常仍通过
console.*输出,无法在运行日志页面查询。修复
cleanupLogsalarm:LogService读取日志保留天数并调用LoggerDAO.deleteBefore()删除截止时间之前的日志。0定义为关闭自动清理,避免误删全部日志。min={0}。后台业务日志整理
将以下明确属于业务流程的
console.*迁移到项目 Logger:日志使用
service、component、uuid、path、count等结构化标签。不会记录脚本 value 内容、网络正文、Cookie、Header 或响应内容。批量 UUID 日志限制为前 20 个,避免单条日志过大。以下底层输出有意继续使用 console:
chrome.runtime.lastError;Tests / 测试
pnpm exec vitest run src/app/service/service_worker/log.test.ts src/app/service/service_worker/script.test.ts src/app/service/service_worker/runtime.test.ts src/app/service/service_worker/regular_updatecheck.test.ts --reporter=dotpnpm run typecheckgit diff --checkpnpm test全量测试通过Screenshots / 截图
无明显 UI 变化,仅为现有日志清理天数输入框增加最小值约束。