Skip to content

chore: more logs for cooperation - #652

Merged
re2zero merged 1 commit into
linuxdeepin:masterfrom
re2zero:bugfix
Jul 3, 2025
Merged

chore: more logs for cooperation#652
re2zero merged 1 commit into
linuxdeepin:masterfrom
re2zero:bugfix

Conversation

@re2zero

@re2zero re2zero commented Jul 1, 2025

Copy link
Copy Markdown
Contributor

Add more logs for cooperation.

Log: more logs for cooperation.

Summary by Sourcery

Add extensive debug and informational logging across cooperation modules to enhance traceability of network operations, discovery, GUI interactions, settings management, and compatibility layers.

Enhancements:

  • Insert detailed DLOG and qInfo statements for network message handling and async RPC results in NetworkUtil
  • Add logs for discovery controller events, device parsing, service updates, and history management
  • Introduce logging in GUI widgets and dialogs for state changes, user actions, and theme handling
  • Log configuration loading, saving, and value changes in Settings and DConfigManager
  • Add trace logs in transfer and share helpers, compat wrapper, and common utilities for improved debugging

@sourcery-ai

sourcery-ai Bot commented Jul 1, 2025

Copy link
Copy Markdown

Reviewer's Guide

This PR enhances traceability by injecting comprehensive debug and info logs across the cooperation modules, covering network handling, discovery, configuration I/O, sharing and transferring workflows, UI components, and plugin lifecycle events.

Class diagram for updated Settings logging

classDiagram
    class SettingsPrivate {
        +fromJsonFile(fileName, data)
        +fromJson(json, data)
        +toJson(data)
        +_q_onFileChanged(filePath)
        +DLOG/qInfo statements for file and JSON operations
    }
    class Settings {
        +contains(group, key)
        +groups()
        +keys(group)
        +keyList(group)
        +value(group, key, defaultValue)
        +setValue(group, key, value)
        +setValueNoNotify(group, key, value)
        +removeGroup(group)
        +isRemovable(group, key)
        +remove(group, key)
        +sync()
        +setAutoSync(autoSync)
        +onFileChanged(filePath)
        +setWatchChanges(watchChanges)
        +DLOG/qInfo statements for all major actions
    }
Loading

File-Level Changes

Change Details Files
NetworkUtil detailed flow logging
  • Log receipt and dispatch of each message mask
  • Trace connect status branches and error cases
  • Record RPC callback entry, success/failure paths
  • Log fallback and next-request sequences
src/lib/cooperation/core/net/networkutil.cpp
Discovery and device info tracing
  • Log controller construction, service signals and loops
  • Trace device JSON parsing, validity checks and list updates
  • Log history and avahi discovery flows
  • Record device lost and online state changes
src/lib/cooperation/core/discover/discovercontroller.cpp
src/lib/cooperation/core/discover/deviceinfo.cpp
Configuration file I/O and settings logging
  • Unify qInfo/qDebug to include plain file paths
  • Log JSON load, parse errors, file-change detection
  • Trace settings value get/set, group removal and sync operations
  • Log DConfigManager and ConfigManager lifecycle events
src/configs/settings/settings.cpp
src/lib/cooperation/dfmplugin/configs/settings/settings.cpp
src/lib/cooperation/dfmplugin/configs/settings/configmanager.cpp
Share and Transfer helper logging
  • Log notice initialization and notification flows
  • Trace user action triggers and share/transfer reply handling
  • Log transfer progress updates, results and exceptions
src/lib/cooperation/core/net/helper/sharehelper.cpp
src/lib/cooperation/core/net/helper/transferhelper.cpp
UI components and event logging
  • Log widget and dialog init, theme changes, and paint events
  • Trace user interaction events, focus changes and event filter paths
  • Record device list updates, workspace widget transitions and search flows
src/lib/cooperation/core/gui/widgets/deviceitem.cpp
src/lib/cooperation/core/gui/widgets/devicelistwidget.cpp
src/lib/cooperation/core/gui/utils/sortfilterworker.cpp
src/lib/cooperation/core/gui/widgets/cooperationstatewidget.cpp
src/lib/cooperation/core/gui/phone/vncviewer.cpp
src/lib/cooperation/core/gui/win/cooperationsearchedit.cpp
Compat IPC and plugin lifecycle tracing
  • Log IPC message types, parsing and compat callbacks
  • Trace plugin initialization, menu binding and core options
  • Log common utils events like IP lookup and translator loading
src/lib/cooperation/core/net/compatwrapper.cpp
src/lib/cooperation/dfmplugin/cooperationplugin.cpp
src/lib/cooperation/core/cooperationcoreplugin.cpp
src/common/commonutils.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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @re2zero - I've reviewed your changes - here's some feedback:

  • There’s a very high volume of new log statements—consider trimming redundant entries and using appropriate log levels (INFO vs DEBUG) so production logs remain concise and readable.
  • A lot of these logs follow repetitive patterns—think about consolidating them into helper functions or macros for consistency and to reduce boilerplate.
  • Many logs are inside performance-sensitive code paths (UI events, loops)—you may want to guard them under debug flags or remove non-critical logs to avoid runtime overhead in release builds.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- There’s a very high volume of new log statements—consider trimming redundant entries and using appropriate log levels (INFO vs DEBUG) so production logs remain concise and readable.
- A lot of these logs follow repetitive patterns—think about consolidating them into helper functions or macros for consistency and to reduce boilerplate.
- Many logs are inside performance-sensitive code paths (UI events, loops)—you may want to guard them under debug flags or remove non-critical logs to avoid runtime overhead in release builds.

## Individual Comments

### Comment 1
<location> `src/lib/cooperation/core/net/compatwrapper.cpp:113` </location>
<code_context>
             // 非跨端应用无需处理
-            if (appInfo.appname != ipc::CooperRegisterName)
+            if (appInfo.appname != ipc::CooperRegisterName) {
+                DLOG << "App is not CooperRegisterName, skipping";
                 continue;
+            }
</code_context>

<issue_to_address>
Logging every skipped app in peer list may be excessive.

For large peer lists, this could flood the logs. Consider if logging each skipped app is necessary.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
            if (appInfo.appname != ipc::CooperRegisterName) {
                DLOG << "App is not CooperRegisterName, skipping";
                continue;
            }
=======
            if (appInfo.appname != ipc::CooperRegisterName) {
                continue;
            }
>>>>>>> REPLACE

</suggested_fix>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread src/lib/cooperation/core/net/compatwrapper.cpp
@deepin-bot

deepin-bot Bot commented Jul 1, 2025

Copy link
Copy Markdown

TAG Bot

New tag: 1.1.11
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #653

Add more logs for cooperation.

Log: more logs for cooperation.
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: lzwind, re2zero

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

@re2zero
re2zero merged commit 8dbe606 into linuxdeepin:master Jul 3, 2025
14 of 16 checks passed
@re2zero
re2zero deleted the bugfix branch July 3, 2025 03:15
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