Skip to content

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

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

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

Conversation

@add-uos

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

Copy link
Copy Markdown
Contributor

概要 / Summary

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

  • 日志分类化:核心源文件(main.cpp、Settings.cpp、audioprocessingthread.cpp、basepub/datamanager.cpp、camera.cpp、capplication.cpp、circlepushbutton.cpp)中活跃的 qDebug()/qInfo()/qWarning() 调用转换为 qCDebug/qCInfo/qCWarning(appLog),统一使用 org.deepin.camera 分类,并补充 ddlog.h 头文件引入;注释代码保持原样
  • 动态日志规则:logconfigread.cpp 在应用实例创建前注册 DConfig(org.deepin.camera,键 log_rules)并监听 valueChanged,运行中实时切换级别;DConfig 不可用时回退环境变量
  • 新增 dconfig 元数据 src/assets/org.deepin.camera.json(键 log_rules),旧 org.deepin.camera.encode.json 移除废弃 rules 键,src/CMakeLists.txt 同步安装两个元数据
  • SPDX 版权年份更新为包含 2026

注:本 PR 为拆分提交的第 1 部分,与第 2、3 部分配合使用;单独合入不影响其余部分后续合入,完整功能三部分合入后生效(完整改动已整体验证:Qt6 Release 构建通过、四档日志级别实测生效)。

Summary by Sourcery

Introduce categorized application logging and DConfig metadata as the first step toward dynamic runtime log-level control for deepin-camera.

New Features:

  • Add DConfig metadata for the org.deepin.camera log_rules setting and install it with the application configuration.
  • Route active camera application logs through the org.deepin.camera category to support configurable log filtering.

Enhancements:

  • Prepare the first set of camera components for centralized dynamic log-level control while preserving existing logging behavior for commented code.

Build:

  • Update CMake installation to include the new logging configuration metadata.

Chores:

  • Update SPDX copyright ranges through 2026 and remove the obsolete encode configuration rules entry.

Convert plain qDebug/qInfo/qWarning to categorized qCDebug/qCInfo/qCWarning
with org.deepin.camera category in core files, register log_rules DConfig
listening before application creation, and add dconfig meta
org.deepin.camera.json.

将核心文件的普通日志宏改为带 org.deepin.camera 分类的 qCDebug/qCInfo/qCWarning,
注册 log_rules DConfig 监听,新增 dconfig 元数据文件。

Log: 适配deepin-debug-config调试模式(1/3)
Influence: 可通过deepin-debug-config动态切换deepin-camera的日志输出级别
@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 first split PR adapts the core logging paths to the org.deepin.camera category and adds the metadata and initialization flow needed for DConfig-driven, runtime log-level changes, with an environment fallback and updated packaging metadata.

Sequence diagram for runtime log level configuration

sequenceDiagram
    participant App as deepin-camera
    participant DConfig
    participant Env as Environment
    participant Logger as DDLog

    App->>DConfig: Register org.deepin.camera log_rules
    alt DConfig is available
        DConfig-->>App: valueChanged
        App->>Logger: Update log rules
    else DConfig is unavailable
        App->>Env: Read log rule fallback
        Env-->>App: Log rules
        App->>Logger: Update log rules
    end
Loading

File-Level Changes

Change Details Files
Routes active application logging through the categorized org.deepin.camera log category.
  • Added ddlog.h and adopted appLog for debug, info, and warning messages.
  • Converted active qDebug, qInfo, and qWarning calls while preserving commented-out logging.
  • Updated copyright and SPDX year ranges through 2026.
src/main.cpp
src/src/Settings.cpp
src/src/audioprocessingthread.cpp
src/src/basepub/datamanager.cpp
src/src/camera.cpp
src/src/capplication.cpp
src/src/circlepushbutton.cpp
Adds DConfig metadata and build installation support for runtime log-rule configuration.
  • Introduced org.deepin.camera.json with the log_rules key.
  • Registered both configuration metadata files for DTK 6 and legacy installation paths.
  • Removed the obsolete rules key from the encode metadata.
src/assets/org.deepin.camera.json
src/assets/org.deepin.camera.encode.json
src/CMakeLists.txt
Enables dynamic log-level control through DConfig with an environment-variable fallback.
  • Registers the org.deepin.camera DConfig and reads log_rules before application-instance creation.
  • Listens for configuration changes to update logging rules while the application runs.
  • Falls back to environment-based configuration when DConfig is unavailable.
src/logconfigread.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

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

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

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次提交将 Qt 通用日志调用(qDebug/qInfo/qWarning)迁移为分类日志(qCDebug/qCInfo/qCWarning + appLog),并新增 DConfig 配置文件支持动态日志级别控制。变更涉及 10 个文件,改动一致性好,语法正确,无安全漏洞,性能上通过分类日志和动态配置实现了改进。

🔍 详细分析

1. 语法逻辑 ✅

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

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

建议: ['建议确认 ddlog.h 头文件已在项目中定义 appLog 日志类别(QLoggingCategory),确保编译通过。']


2. 代码质量 ✅

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

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

建议: ['可考虑在后续提交中将 using namespace DDLog; 替换为显式限定 DDLog::appLog,以减少命名空间污染风险。']


3. 代码性能 ✅

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

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

建议: []


4. 代码安全 🔒

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

🔐 发现 0 个安全漏洞

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

建议: []


💡 改进建议代码示例


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

@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

@add-uos

add-uos commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

This pr force merged! (status: unstable)

@deepin-bot
deepin-bot Bot merged commit 92e8aad into linuxdeepin:master Oct 30, 2026
14 of 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