Skip to content

chore: [log]More logs#142

Merged
re2zero merged 1 commit into
linuxdeepin:masterfrom
re2zero:bugfix
May 26, 2025
Merged

chore: [log]More logs#142
re2zero merged 1 commit into
linuxdeepin:masterfrom
re2zero:bugfix

Conversation

@re2zero
Copy link
Copy Markdown
Contributor

@re2zero re2zero commented May 26, 2025

Add more logs for log coverage.

Log: Add more logs.

Summary by Sourcery

Add comprehensive logging throughout the codebase to improve traceability of operations and state changes.

Enhancements:

  • Add debug and warning logs in core components (cipher support checks, serialization/deserialization, mapping, device operations, and filesystem handlers) to trace internal workflows.
  • Instrument worker threads (WorkThread, FixThread, ProbeThread, Watcher) with logging for lifecycle events, command execution, and operation outcomes.
  • Augment UI widgets and dialogs (DeviceListWidget, CreateVGWidget, DiskBadSectorsDialog, PartitionWidget, MountDialog, UnmountDialog, MainWindow, etc.) with logs for construction, user actions, state transitions, and signal-slot connections.

Add more logs for log coverage.

Log: Add more logs.
@deepin-ci-robot
Copy link
Copy Markdown

deepin pr auto review

关键摘要:

  • 在多个文件中添加了调试信息(qDebug),这有助于开发者了解代码的执行流程和状态,但应避免在生产环境中保留这些调试信息。
  • Common::getLabelAdjustHeight函数中,qDebug被添加用于调试,但在返回高度值之前,应该检查label是否为空,以避免潜在的空指针异常。
  • CusApplication::CusApplicationAnimationDialog::AnimationDialog构造函数中,qDebug用于记录初始化信息,这有助于调试。
  • CreateLVWidgetCreateVGWidget等类中,qDebug用于记录用户操作和状态变化,有助于追踪用户交互流程。
  • DmTreeviewDelegate::paint函数中,qDebug用于记录绘制事件,这有助于调试UI绘制过程。
  • PartitionWidgetResizeDialog等类中,qDebug用于记录用户操作和状态变化,有助于追踪用户交互流程。
  • MessageBoxUnmountDialog等类中,qDebug用于记录对话框的创建和用户交互,有助于调试用户界面。

是否建议立即修改:

建议立即修改的原因是,虽然添加调试信息有助于开发过程中的问题定位,但过多的调试信息在生产环境中可能会泄露敏感信息,影响性能,并可能被恶意用户利用。因此,建议在生产环境中移除或禁用这些调试信息。同时,对于可能引发空指针异常的代码,应该进行相应的空值检查,以避免程序崩溃。

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

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 and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

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.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 26, 2025

Reviewer's Guide

This PR instruments the entire codebase with extensive logging by inserting qDebug/qInfo/qWarning statements across core model classes, service operations, filesystem handlers, and UI components to improve runtime observability and debugging.

Updated Class Diagram for ProbeThread

classDiagram
  class ProbeThread {
    -QList<DeviceInfo> m_inforesult
    -QMap<QString, Device> m_deviceMap
    -LVMInfo m_lvmInfo
    -LUKSMap m_luksInfo
    +ProbeThread(QObject* parent)
    +void probeDeviceInfo()
  }
Loading

Updated Class Diagram for DeviceListWidget

classDiagram
  class DeviceListWidget {
    -QString m_curChooseDevicePath
    -QString m_curChooseVGName
    -DmTreeview* m_treeView
    +DeviceListWidget(QWidget* parent)
    +~DeviceListWidget()
    -void initUi()
    -void initConnection()
    -void treeMenu(const QPoint& pos)
    -void onDiskInfoClicked()
    -void onDiskCheckHealthClicked()
    -void onDiskBadSectorsClicked()
    -void onCreatePartitionTableClicked()
    -void onPartitionErrorCheckClicked()
    -void onHidePartitionClicked()
    -void onShowPartitionClicked()
    -void onDeletePartitionClicked()
    -void onDeleteVGClicked()
    -void onCreateLVClicked()
    -void onDeleteLVClicked()
    -void onVGDeleteMessage(const QString& vgMessage)
    -void onLVDeleteMessage(const QString& lvMessage)
    -void setCurDevicePath(const QString& devPath)
    -void setCurVGName(const QString& vgName)
    -void onUpdateDeviceInfo()
  }
Loading

Updated Class Diagram for NTFS Filesystem Handler

classDiagram
  namespace DiskManager {
    class NTFS {
      -FS_Limits m_fsLimits
      +FS getFilesystemSupport()
      +void setUsedSectors(Partition& partition)
      +void readLabel(Partition& partition)
      +bool writeLabel(const Partition& partition)
      +void readUuid(Partition& partition)
      +bool writeUuid(const Partition& partition)
      +bool create(const Partition& newPartition)
      +bool checkRepair(const Partition& partition)
      +bool checkRepair(const QString& devpath)
    }
  }
Loading

Updated Class Diagram for DiskManagerService

classDiagram
  class DiskManagerService {
    -PartedCore* m_partedcore
    -QString m_frontEndDBusName
    +DiskManagerService(const QString& frontEndDBusName, QObject* parent)
    +DeviceInfo getDeviceinfo()
    +bool format(const QString& fstype, const QString& name)
    -bool checkAuthorization()
  }
Loading

File-Level Changes

Change Details Files
Instrumented data structures and D-Bus serialization methods with debug logs.
  • Add entry/exit debug statements in supportDecrypt/Encrypt/notSupportCrypt/supportAllcrypt methods
  • Log start/completion in operator<< and operator>> overloads for structural and partition info classes
  • Add debug messages in constructors and key getters/setters
basestruct/luksstruct.cpp
basestruct/lvmstruct.cpp
basestruct/utils.cpp
basestruct/partitioninfo.cpp
basestruct/deviceinfo.cpp
Enhanced logging in service threads, operators, and authorization flows.
  • Log thread creation, run parameters, and completion/stopping events in WorkThread, FixThread, ProbeThread
  • Add debug and warning logs for authorization success/failure in DiskManagerService and PolicyKitHelper
  • Instrument LVMOperator and LUKSOperator methods with entry/exit and error logs
  • Log command executions and cache loading in Utils, Watcher, BlockSpecial, ProcPartitionsInfo, SupportedFileSystems
service/diskoperation/thread.cpp
service/diskmanagerservice.cpp
service/PolicyKitHelper.cpp
service/watcher.cpp
service/diskoperation/lvmoperator/lvmoperator.cpp
service/diskoperation/luksoperator/luksoperator.cpp
service/diskoperation/blockspecial.cpp
service/diskoperation/procpartitionsinfo.cpp
service/diskoperation/supportedfilesystems.cpp
Inserted debug logs across filesystem modules for lifecycle and operations.
  • Add entry/exit logs in getFilesystemSupport, setUsedSectors, read/write label and UUID, create, resize, and checkRepair methods
  • Log external command invocations and outcomes in each FS handler
service/diskoperation/filesystems/ntfs.cpp
service/diskoperation/filesystems/xfs.cpp
service/diskoperation/filesystems/ext2.cpp
service/diskoperation/filesystems/btrfs.cpp
service/diskoperation/filesystems/fat16.cpp
service/diskoperation/filesystems/exfat.cpp
service/diskoperation/filesystems/linuxswap.cpp
Augmented UI components and dialogs with detailed interaction logs.
  • Log constructors, initUi/initConnection and lifecycle events in widgets and dialogs
  • Record user actions (button clicks, menu display, selection changes, key events) with contextual data
  • Add warnings and info logs for validation failures and operation outcomes
application/widgets/devicelistwidget.cpp
application/widgets/createvgwidget.cpp
application/widgets/diskbadsectorsdialog.cpp
application/widgets/diskinfodisplaydialog.cpp
application/widgets/infoshowwidget.cpp
application/widgets/mainsplitter.cpp
application/widgets/mainwindow.cpp
application/widgets/mountdialog.cpp
application/widgets/unmountdialog.cpp
application/widgets/resizedialog.cpp
application/widgets/formatedialog.cpp
application/widgets/removepvwidget.cpp
application/widgets/diskhealthdetectiondialog.cpp
application/widgets/customcontrol/dmtreeview.cpp
application/widgets/customcontrol/dmtreeviewdelegate.cpp
application/widgets/customcontrol/partitionwidget.cpp
application/widgets/customcontrol/ddbase.cpp
application/widgets/customcontrol/dmframewidget.cpp
application/widgets/customcontrol/partchartshowing.cpp
application/widgets/customcontrol/vgsizeinfowidget.cpp
application/widgets/customcontrol/sizeinfowidget.cpp
application/widgets/customcontrol/passwordinputdialog.cpp
application/widgets/customcontrol/selectpvitemwidget.cpp
application/widgets/customcontrol/buttonlabel.cpp
application/widgets/cylinderinfowidget.cpp
application/widgets/cylinderwidget.cpp
application/widgets/partitiontableerrorsinfodialog.cpp
application/widgets/partitiontableerrorsinfodelegate.cpp
application/widgets/diskhealthdetectiondelegate.cpp
application/widgets/animationdialog.cpp
application/widgets/centerwidget.cpp
application/widgets/createpartitiontabledialog.cpp
Added initialization and utility logging during application startup.
  • Log PATH and argument validation in main.cpp
  • Instrument Common and CusApplication helpers with debug statements
service/main.cpp
application/common.cpp
application/cusapplication.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

[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 1b67a1c into linuxdeepin:master May 26, 2025
15 of 17 checks passed
@re2zero re2zero deleted the bugfix branch May 26, 2025 05:07
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