dde-file-manager icon indicating copy to clipboard operation
dde-file-manager copied to clipboard

chore: update logging category usage in encrypt manager

Open Johnson-zs opened this issue 5 months ago • 1 comments

  • Reintroduced the logging category for the encrypt manager in both the header and implementation files to ensure consistent logging practices.
  • This change enhances the visibility of operations within the encrypt manager, aiding in debugging and monitoring.

Log: This commit updates the logging category usage in the encrypt manager, improving logging consistency and clarity.

Summary by Sourcery

Reintroduce and register the encryption manager logging category to ensure consistent and clear logging for debugging and monitoring.

Enhancements:

  • Re-add DFM_LOG_USE_CATEGORY in encrypt_manager_global.h for the encrypt manager namespace
  • Register the DPENCRYPTMANAGER_NAMESPACE logging category in encryptmanager.cpp

Johnson-zs avatar Jun 27 '25 03:06 Johnson-zs

Reviewer's Guide

Refines logging macros, restores encrypt manager’s logging category, and standardizes macro usage across preview, plugin, and service modules by replacing legacy calls with the corrected registration macro.

Class diagram for logging macro usage in encrypt manager

classDiagram
    class EncryptManager {
        +void initialize()
        <<uses>> QLoggingCategory
    }
    class QLoggingCategory
    EncryptManager -- QLoggingCategory : uses
    note for EncryptManager "DFM_LOG_REGISTER_CATEGORY(DPENCRYPTMANAGER_NAMESPACE) is now used to register logging category."

Class diagram for logging macro definitions and usage

classDiagram
    class DFM_LOG_REGISTER_CATEGORY {
        <<macro>>
        +registers a QLoggingCategory for a namespace
    }
    class DFM_LOG_USE_CATEGORY {
        <<macro>>
        +enables use of registered logging category in a namespace
    }
    class QLoggingCategory
    DFM_LOG_REGISTER_CATEGORY ..> QLoggingCategory : registers
    DFM_LOG_USE_CATEGORY ..> QLoggingCategory : uses

File-Level Changes

Change Details Files
Refine and correct logging macro definitions in the core log defines
  • Rename misspelled DFM_LOG_REISGER_CATEGORY to DFM_LOG_REGISTER_CATEGORY
  • Add compatibility alias for the legacy macro name
  • Adjust undef and define directives to align with the new macro name
include/dfm-base/dfm_log_defines.h
Reintroduce and register the encrypt manager logging category
  • Add DFM_LOG_USE_CATEGORY for DPENCRYPTMANAGER_NAMESPACE in the global header
  • Register DPENCRYPTMANAGER_NAMESPACE with DFM_LOG_REGISTER_CATEGORY in the implementation
src/plugins/filemanager/dfmplugin-encrypt-manager/encrypt_manager_global.h
src/plugins/filemanager/dfmplugin-encrypt-manager/encryptmanager.cpp
Bulk replace legacy logging macro calls across preview, plugin, and service modules
  • Swap all DFM_LOG_REISGER_CATEGORY invocations to DFM_LOG_REGISTER_CATEGORY
  • Ensure consistent use of the new macro in preview, plugin, daemon, desktop, filedialog, filemanager, and service files
src/apps/dde-file-manager-preview/filepreview/previewlibrary.cpp
src/apps/dde-file-manager-preview/libdfm-preview/filepreview.cpp
src/apps/dde-file-manager-preview/pluginpreviews/dciicon-preview/ddciiconpreview.cpp
src/apps/dde-file-manager-preview/pluginpreviews/image-preview/imagepreviewplugin.cpp
src/apps/dde-file-manager-preview/pluginpreviews/music-preview/musicpreviewplugin.cpp
src/apps/dde-file-manager-preview/pluginpreviews/pdf-preview/pdfpreviewplugin.cpp
src/apps/dde-file-manager-preview/pluginpreviews/text-preview/textpreviewplugin.cpp
src/apps/dde-file-manager-preview/pluginpreviews/video-preview/videopreviewplugin.cpp
src/plugins/common/dfmplugin-bookmark/bookmark.cpp
src/plugins/common/dfmplugin-burn/burn.cpp
src/plugins/common/dfmplugin-dirshare/dirshare.cpp
src/plugins/common/dfmplugin-emblem/emblem.cpp
src/plugins/common/dfmplugin-fileoperations/fileoperations.cpp
src/plugins/common/dfmplugin-menu/menu.cpp
src/plugins/common/dfmplugin-propertydialog/propertydialog.cpp
src/plugins/common/dfmplugin-tag/tag.cpp
src/plugins/common/dfmplugin-trashcore/trashcore.cpp
src/plugins/common/dfmplugin-utils/utils.cpp
src/plugins/daemon/core/core.cpp
src/plugins/daemon/core/devicemanagerdbus.cpp
src/plugins/daemon/filemanager1/filemanager1.cpp
src/plugins/daemon/recent/recentdaemon.cpp
src/plugins/daemon/tag/tagdaemon.cpp
src/plugins/daemon/vault/vaultdaemon.cpp
src/plugins/desktop/ddplugin-background/backgroundplugin.cpp
src/plugins/desktop/ddplugin-canvas/canvasplugin.cpp
src/plugins/desktop/ddplugin-core/core.cpp
src/plugins/desktop/ddplugin-organizer/organizerplugin.cpp
src/plugins/desktop/ddplugin-wallpapersetting/settingsdbusinterface.cpp
src/plugins/filedialog/core/core.cpp
src/plugins/filemanager/dfmplugin-avfsbrowser/avfsbrowser.cpp
src/plugins/filemanager/dfmplugin-computer/computer.cpp
src/plugins/filemanager/dfmplugin-core/core.cpp
src/plugins/filemanager/dfmplugin-detailspace/detailspace.cpp
src/plugins/filemanager/dfmplugin-myshares/myshares.cpp
src/plugins/filemanager/dfmplugin-optical/optical.cpp
src/plugins/filemanager/dfmplugin-recent/recent.cpp
src/plugins/filemanager/dfmplugin-search/search.cpp
src/plugins/filemanager/dfmplugin-sidebar/sidebar.cpp
src/plugins/filemanager/dfmplugin-smbbrowser/smbbrowser.cpp
src/plugins/filemanager/dfmplugin-titlebar/titlebar.cpp
src/plugins/filemanager/dfmplugin-trash/trash.cpp
src/plugins/filemanager/dfmplugin-vault/vault.cpp
src/plugins/filemanager/dfmplugin-workspace/workspace.cpp
src/services/accesscontrol/accesscontroldbus.cpp
src/services/mountcontrol/mountcontroldbus.cpp
src/services/sharecontrol/sharecontroldbus.cpp
src/services/textindex/textindexdbus.cpp
Clean up obsolete logging comments and formatting in the preview application
  • Remove commented-out DFM_LOG_REISGER_CATEGORY line
  • Fix trailing space and line break in fmInfo() call
src/apps/dde-file-manager-preview/filepreview/previewsingleapplication.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

  • Contact our support team for questions or feedback.
  • Visit our documentation for detailed guides and information.
  • Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.

sourcery-ai[bot] avatar Jun 27 '25 03:06 sourcery-ai[bot]

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Johnson-zs

The full list of commands accepted by this bot can be found here.

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 avatar Jun 27 '25 05:06 deepin-ci-robot

deepin pr auto review

代码审查意见:

  1. dfm_log_defines.h文件中,DFM_LOG_REISGER_CATEGORY宏被重命名为DFM_LOG_REGISTER_CATEGORY,但是DFM_LOG_REISGER_CATEGORY宏的定义仍然存在,可能会导致混淆。建议删除或重命名DFM_LOG_REISGER_CATEGORY宏的定义,以避免潜在的混淆。

  2. previewlibrary.cpppreviewsingleapplication.cppfilepreview.cppddciiconpreview.cppimagepreviewplugin.cppmusicpreviewplugin.cpppdfpreviewplugin.cpptextpreviewplugin.cppvideopreviewplugin.cppbookmark.cppburn.cppdirshare.cppemblem.cppfileoperations.cppmenu.cpppropertydialog.cpptag.cpptrashcore.cpputils.cppcore.cppdevicemanagerdbus.cppfilemanager1.cpprecentdaemon.cpptagdaemon.cppvaultdaemon.cppbackgroundplugin.cppcanvasplugin.cppcore.cpporganizerplugin.cppsettingsdbusinterface.cppcore.cppavfsbrowser.cppcomputer.cppcore.cppdetailspace.cppencrypt_manager_global.hencryptmanager.cppmyshares.cppoptical.cpprecent.cppsearch.cppsidebar.cppsmbbrowser.cpptitlebar.cpptrash.cppvault.cppworkspace.cppaccesscontroldbus.cppmountcontroldbus.cppsharecontroldbus.cpptextindexdbus.cpp等文件中,DFM_LOG_REISGER_CATEGORY宏被替换为DFM_LOG_REGISTER_CATEGORY。建议检查这些文件,确保所有使用DFM_LOG_REISGER_CATEGORY宏的地方都已经更新为DFM_LOG_REGISTER_CATEGORY,以保持代码的一致性。

  3. encrypt_manager_global.h文件中,DFM_LOG_USE_CATEGORY宏被移动到了文件末尾,这可能会导致编译错误,因为DFM_LOG_USE_CATEGORY宏在文件的其他地方被使用。建议将DFM_LOG_USE_CATEGORY宏的声明和定义移动到文件的开头,或者确保在使用DFM_LOG_USE_CATEGORY宏之前已经包含了相应的头文件。

  4. encryptmanager.cpp文件中,DFM_LOG_REGISTER_CATEGORY宏被添加,但是没有看到对应的#include语句。建议在文件开头添加#include "dfm_log_defines.h",以确保DFM_LOG_REGISTER_CATEGORY宏可以被正确解析。

  5. encryptmanager.cpp文件中,EncryptManager::initialize函数的实现中,没有看到对initialize函数的具体实现。建议检查initialize函数的实现,确保它正确地初始化了EncryptManager类。

  6. encryptmanager.cpp文件中,EncryptManager::initialize函数的实现中,没有看到对initialize函数的注释。建议添加注释,说明initialize函数的作用和实现细节。

  7. encryptmanager.cpp文件中,EncryptManager::initialize函数的实现中,没有看到对initialize函数的异常处理。建议添加异常处理,以确保在初始化过程中出现错误时能够正确处理。

  8. encryptmanager.cpp文件中,EncryptManager::initialize函数的实现中,没有看到对initialize函数的性能优化。建议检查initialize函数的实现,确保它没有性能瓶颈。

  9. encryptmanager.cpp文件中,EncryptManager::initialize函数的实现中,没有看到对initialize函数的代码质量检查。建议使用代码质量检查工具,如clang-tidy,来检查initialize函数的代码质量。

  10. encryptmanager.cpp文件中,EncryptManager::initialize函数的实现中,没有看到对initialize函数的单元测试。建议编写单元测试,以确保initialize函数的正确性和稳定性。

deepin-ci-robot avatar Jun 27 '25 05:06 deepin-ci-robot

@sourcery-ai review

Johnson-zs avatar Jun 27 '25 05:06 Johnson-zs

/forcemerge

Johnson-zs avatar Jun 27 '25 06:06 Johnson-zs

This pr force merged! (status: blocked)

deepin-bot[bot] avatar Jun 27 '25 06:06 deepin-bot[bot]