Repository navigation
fix(log): unify all logs to category appLog for DConfig filtering - #424
Conversation
Reviewer's GuideThis PR standardizes logging for all three executables around a single shared Sequence diagram for categorized log filteringsequenceDiagram
participant Executable
participant appLog
participant DConfig
participant Viewer as deepin-log-viewer
Executable->>appLog: qCDebug(appLog)
Executable->>appLog: qCInfo(appLog)
Executable->>appLog: qCWarning(appLog)
Executable->>appLog: qCCritical(appLog)
appLog->>DConfig: org.deepin.reader
DConfig->>Viewer: log_rules filtering
Viewer-->>DConfig: filtered application logs
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="batch-print/batchprintapp.cpp" line_range="38" />
<code_context>
if (cups) {
if (!cups->init()) {
- qWarning() << "CUPS init failed";
+ qCWarning(appLog) << "CUPS init failed";
NotifyClient::notifyError(ErrorMessages::cupsUnavailable());
return 2;
</code_context>
<issue_to_address>
**Helper logs ignore configured filters**
When DConfig `log_rules` are configured to filter logs emitted by batch-print or htmltopdf, `batchprint` and `htmltopdf` run in separate processes and do not load the DConfig rules, so their categorized logs retain the process defaults instead of honoring those filters.
Load and apply the DConfig logging rules in both helper processes.
Also at `htmltopdf/main.cpp:19`.
</issue_to_address>| if (cups) { | ||
| if (!cups->init()) { | ||
| qWarning() << "CUPS init failed"; | ||
| qCWarning(appLog) << "CUPS init failed"; |
There was a problem hiding this comment.
🟡 Medium · Helper logs ignore configured filters
When DConfig log_rules are configured to filter logs emitted by batch-print or htmltopdf, batchprint and htmltopdf run in separate processes and do not load the DConfig rules, so their categorized logs retain the process defaults instead of honoring those filters.
Load and apply the DConfig logging rules in both helper processes.
Also at htmltopdf/main.cpp:19.
Prompt for AI agents
In `batch-print/batchprintapp.cpp` at line 38:
**Helper logs ignore configured filters**
When DConfig `log_rules` are configured to filter logs emitted by batch-print or htmltopdf, `batchprint` and `htmltopdf` run in separate processes and do not load the DConfig rules, so their categorized logs retain the process defaults instead of honoring those filters.
Load and apply the DConfig logging rules in both helper processes.
Also at `htmltopdf/main.cpp:19`.18cd90e to
1d3f880
Compare
- Replace bare qInfo/qDebug/qWarning/qCritical with categorized qC* variants in reader, batch-print and htmltopdf modules - Refine ddlog.h into a pure Qt header and share it across all three executables, keeping only one appLog definition - Update SPDX copyright years Log: 统一全项目日志为分类日志并收敛ddlog.h定义 PMS: TASK-396789 Influence: 三个进程日志均带org.deepin.reader分类,可被DConfig日志规则统一过滤。
2951a01 to
ebf1296
Compare
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: [] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: [] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: [] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例本次变更无需修复,代码质量优秀。以下为分类日志的正确使用示例(已在本次提交中正确实现):
// dpdflog.h — deepin-pdfium 模块日志分类声明 #ifndef DPDFLOG_H #define DPDFLOG_H #include <QLoggingCategory> Q_DECLARE_LOGGING_CATEGORY(dpfLog) #endif // DPDFLOG_H
// dpdfglobal.cpp — 分类定义 Q_LOGGING_CATEGORY(dpfLog, "org.deepin.reader.pdfium")
// 使用处 — 统一使用分类日志 qCDebug(dpfLog) << "Loading PDF document:" << filePath; qCWarning(dpfLog) << "Failed to open file for writing:" << targetPath;本报告由 AI 代码审查工具自动生成 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: add-uos, lzwind The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/merge |
变更说明 (TASK-396789)
统一全项目日志为分类日志,使日志可被 DConfig(deepin-log-viewer) 统一过滤。
改动点
qInfo/qDebug/qWarning/qCritical全部替换为qC*Info(appLog)等分类写法appLog定义,不再有副本效果
三个可执行(deepin-reader / deepin-reader-batchprint / htmltopdf)日志均带
org.deepin.reader分类,DConfig 的log_rules(含org.deepin.reader*通配规则)可统一过滤全部日志。自测
Log: 统一全项目日志为分类日志并收敛ddlog.h定义
PMS: TASK-396789
Summary by Sourcery
Unify application logging categories across all reader executables so DConfig can consistently filter their logs.
Enhancements:
Build:
Chores: