Skip to content

feat: adapt deepin-debug-config for dynamic log level control (2/3) - #539

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
add-uos:feat/camera-debugsource-p2
Oct 30, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
add-uos:feat/camera-debugsource-p2

Conversation

@add-uos

@add-uos add-uos commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

概要 / Summary

适配 deepin-debug-config 调试模式(第 2 部分,共 3 部分,按每 10 个文件拆分提交)。

  • 日志分类化:src/src 下 10 个源文件(closedialog.cpp、devnummonitor.cpp、exposureslider.cpp、filterpreviewbutton.cpp、globalutils.cpp、gstvideowriter.cpp、imageitem.cpp、logconfigread.cpp、mainwindow.cpp、majorimageprocessingthread.cpp)中活跃的 qDebug()/qInfo()/qWarning() 调用转换为 qCDebug/qCInfo/qCWarning(appLog),统一使用 org.deepin.camera 分类,并补充 ddlog.h 头文件引入;注释代码保持原样
  • SPDX 版权年份更新为包含 2026

注:本 PR 为拆分提交的第 2 部分,与第 1、3 部分配合使用;文件集与前两部分无交集,无合并冲突。完整改动已整体验证:Qt6 Release 构建通过、四档日志级别实测生效。

Summary by Sourcery

Adapt the second group of camera sources to categorized, dynamically configurable logging.

New Features:

  • Enable dynamic log-level control for the covered camera components through the shared org.deepin.camera logging category.
  • Load and monitor the org.deepin.camera log_rules configuration with an environment-variable fallback.

Enhancements:

  • Route active diagnostic, informational, and warning messages in ten source files through the categorized logging system.
  • Update copyright notices to include 2026.

@sourcery-ai

sourcery-ai Bot commented Oct 30, 2026

Copy link
Copy Markdown

Sorry @add-uos, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 6 days and 4 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Oct 30, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR adapts ten source files to the shared categorized logging API and updates the log configuration reader for live org.deepin.camera/log_rules changes with environment-variable fallback, while refreshing copyright metadata through 2026.

Sequence diagram for dynamic camera log rule updates

sequenceDiagram
    participant Env as Environment
    participant MLogger
    participant DConfig
    participant DDLog
    participant App as CameraApp

    App->>MLogger: MLogger()
    MLogger->>Env: read logRules
    MLogger->>DConfig: create(org.deepin.camera, org.deepin.camera)
    alt DConfig is valid
        MLogger->>DConfig: value(log_rules)
        DConfig-->>MLogger: log rules
        MLogger->>MLogger: appendRules(logRules)
        MLogger->>MLogger: setRules(m_rules)
        DConfig-->>MLogger: valueChanged(log_rules)
        MLogger->>DConfig: value(log_rules)
        MLogger->>DDLog: setRules(updated rules)
    else DConfig is unavailable
        MLogger->>DDLog: setRules(m_rules)
    end
Loading

File-Level Changes

Change Details Files
Migrated active Qt logging calls to the shared org.deepin.camera category so runtime log filtering can control these files.
  • Added ddlog.h and imported the DDLog namespace in each affected source file.
  • Replaced active qDebug(), qInfo(), and qWarning() calls with qCDebug(appLog), qCInfo(appLog), and qCWarning(appLog) while leaving commented-out logging unchanged.
  • Applied the conversion across device monitoring, UI, media processing, image handling, GStreamer recording, and application-window code.
src/src/closedialog.cpp
src/src/devnummonitor.cpp
src/src/exposureslider.cpp
src/src/filterpreviewbutton.cpp
src/src/globalutils.cpp
src/src/gstvideowriter.cpp
src/src/imageitem.cpp
src/src/mainwindow.cpp
src/src/majorimageprocessingthread.cpp
Updated dynamic log-rule loading to use the application-level DConfig key and preserve environment-variable fallback behavior.
  • Switched DConfig from org.deepin.camera.encode to org.deepin.camera.
  • Read and monitor the log_rules key for live rule updates.
  • Apply environment-derived rules after DConfig initialization so they remain effective when DConfig is unavailable.
src/src/logconfigread.cpp
Refreshed source copyright metadata through 2026.
  • Updated copyright ranges in the ten modified source files, including the SPDX ranges where applicable.
src/src/closedialog.cpp
src/src/devnummonitor.cpp
src/src/exposureslider.cpp
src/src/filterpreviewbutton.cpp
src/src/globalutils.cpp
src/src/gstvideowriter.cpp
src/src/imageitem.cpp
src/src/logconfigread.cpp
src/src/mainwindow.cpp
src/src/majorimageprocessingthread.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Convert plain qDebug/qInfo/qWarning to categorized qCDebug/qCInfo/qCWarning
with org.deepin.camera category in src/src files (closedialog, devnummonitor,
exposureslider, filterpreviewbutton, globalutils, gstvideowriter, imageitem,
logconfigread, mainwindow, majorimageprocessingthread), and add ddlog.h
includes.

将 src/src 下 10 个源文件的普通日志宏改为带 org.deepin.camera 分类的
qCDebug/qCInfo/qCWarning,并补充 ddlog.h 头文件引入。

Log: 适配deepin-debug-config调试模式(2/3)
Influence: 可通过deepin-debug-config动态切换deepin-camera的日志输出级别
@deepin-ci-robot

Copy link
Copy Markdown

[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.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 100 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次提交目的是适配 deepin-debug-config 实现动态日志级别控制(2/3),将所有 qDebug/qWarning/qInfo 替换为 qCDebug/qCWarning/qCInfo(appLog) 分类日志, 并更新 logconfigread.cpp 中的 DConfig schema 和 key 名称。代码变更干净一致,语法逻辑正确,DConfig 不可用时的兜底逻辑改进合理, 无安全漏洞,性能无影响,代码质量良好。

🔍 详细分析

1. 语法逻辑 ✅

评价: 语法正确,逻辑清晰 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: ['logconfigread.cpp 中 valueChanged 回调调用 setRules(m_config->value(key).toByteArray()) 直接用 DConfig 值替换全部规则,而构造函数中是 appendRules 后再 setRules(m_rules)(合并模式)。两种路径的规则处理方式不一致,建议统一行为,但此为既有逻辑,不影响本次变更正确性。']


2. 代码质量 ✅

评价: 代码结构清晰,注释完整 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: ['考虑将 using namespace DDLog; 限定在更小作用域内,或直接使用 DDLog::appLog 限定符,以减少命名空间污染风险。']


3. 代码性能 ✅

评价: 性能良好,资源使用合理 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


4. 代码安全 🔒

评价: 存在0个安全漏洞 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: []


💡 改进建议代码示例

// logconfigread.cpp - 建议统一 valueChanged 回调中的规则处理方式
// 当前:valueChanged 回调直接替换全部规则
connect(m_config, &DConfig::valueChanged, this, [this](const QString &key) {
    if (key == "log_rules") {
        // 建议与构造函数一致,使用 appendRules 合并而非直接替换
        QByteArray newRules = m_config->value(key).toByteArray();
        appendRules(newRules);
        setRules(m_rules);
    }
});

本报告由 AI 代码审查工具自动生成

@add-uos

add-uos commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot
deepin-bot Bot merged commit 400cfae into linuxdeepin:master Oct 30, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants