Repository navigation
feat(log): categorize logging and support dynamic log rules via DConfig - #682
Merged
deepin-bot[bot] merged 3 commits intoOct 24, 2026
Merged
Conversation
Categorize all qDebug/qInfo/qWarning calls into qCDebug/qCInfo/qCWarning with the org.deepin.editor category, add MLogger to read log_rules from DConfig (org.deepin.editor) and watch changes at runtime, and add the log_rules key to the DConfig meta file. This enables the deepin debug mode (deepin-debug-config) to dynamically switch log levels. Note: the daemon/ directory is legacy unpackaged qmake code (built for Qt5 with polkit-qt5, not shipped in the deb) and is left unchanged. 日志分类化改造:存量 qDebug/qInfo/qWarning 全部改为带 org.deepin.editor 分类的 qCDebug/qCInfo/qCWarning;新增 MLogger 从 DConfig 读取 log_rules 并监听变更,支持调试模式运行中动态调整日志级别;DConfig meta 增加 log_rules 配置项。 Log: 调试模式适配——日志分类化与动态日志级别 Influence: 应用日志可按 org.deepin.editor 分类过滤,日志级别可动态切换
…ogging The static initializer getLocaleNum() logged via qCDebug before main() runs, before MLogger applies dynamic log rules, leaking debug lines at info/warning levels. Convert to lazy initialization. Log: 修复 info/warning 级别下启动期日志泄漏
|
Sorry @add-uos, your pull request is larger than the review limit of 150,000 diff characters |
…orks QT_NO_DEBUG_OUTPUT makes QLoggingCategoryMacroHolder<QtDebugMsg>:: IsOutputEnabled statically false at compile time, turning qCDebug into a hard no-op. The packaged Release deb therefore can only ever print qCInfo/qCWarning even with the debug mode switched to the debug level. Disabled categorized logs cost one boolean check per call (Qt lazily evaluates arguments), so keep them compiled in; deepin-reader, the reference implementation, does not compile them out either. Log: 修复打包版 Release 构建调试模式无法输出 debug 级日志
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: [] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: [] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: [] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例本报告由 AI 代码审查工具自动生成 |
lzwind
approved these changes
Oct 24, 2026
|
[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 |
Contributor
Author
|
/merge |
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.
Summary / 概述
调试模式(deepin-debug-config)适配:日志分类化 + DConfig 动态日志级别。
qDebug/qInfo/qWarning(52 个文件 3689 处)改为qCDebug/qCInfo/qCWarning(appLog),分类org.deepin.editor(新增src/ddlog.h)src/logger.{h,cpp}(MLogger,参考 deepin-reader),在main()中于任何日志打印前实例化,从 DConfigorg.deepin.editor/log_rules读取规则并监听valueChanged,运行中动态切换日志级别misc/configs/org.deepin.editor.json新增log_rules配置项(默认warning=true),沿用现有 CMake 安装规则encoding.cpp的 locale 探测从静态初始化改为首次使用时初始化,避免在 main() 之前(日志规则尚未生效)打印调试日志daemon/为遗留未打包的 qmake 代码(Qt5 + polkit-qt5,未随 deb 构建/安装),本次不改动。Verification / 验证
cmake -B build-dbgcfg -DCMAKE_BUILD_TYPE=Debug && cmake --build编译通过dde-dconfig --set -a org.deepin.editor -r org.deepin.editor -k log_rules):debug:qCDebug/qCInfo/qCWarning 全部输出(启动 200+ 行)info:仅 qCInfo/qCWarning,qCDebug 无泄漏warning:仅 qCWarningdde-dconfig改规则后新日志立即按新级别输出(valueChanged生效)dtk.core.dsg配置读取日志,无 Qt 框架日志混入Log: 调试模式适配——日志分类化与动态日志级别