-
Notifications
You must be signed in to change notification settings - Fork 178
chore: enhance logging and error handling in file manager components #2917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Improved logging statements across various file manager modules, including DragMonitor, Workspace, and menu handling, to provide clearer insights during operations. - Added checks and warnings for null pointers and invalid states, enhancing error handling in file operations and user interactions. - Streamlined logging practices to ensure consistency and better maintainability throughout the file manager codebase. Log: This commit enhances the logging and error handling mechanisms in the file manager, improving overall visibility and robustness during operations.
Reviewer's GuideThis PR introduces comprehensive logging across the file manager codebase—with fmDebug/fmInfo/fmWarning statements inserted in constructors, key methods, callbacks, and error paths—while adding guard checks for null or invalid inputs and standardizing log level usage. It also enriches file traversal and data-fetching modules with detailed operational tracing and context. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Kakueeen - I've reviewed your changes - here's some feedback:
- The sheer volume of debug/info logs—especially inside hot loops like file iteration and UI paint routines—could introduce performance overhead and clutter; consider auditing log levels and trimming verbosity in performance-critical paths.
- You’ve added many null-pointer and invalid-state checks with warnings; consolidating these guards into shared helper functions or macros would reduce boilerplate and ensure consistent error handling.
- To make post-mortem debugging easier, include consistent context (such as window IDs, URLs, or traversal tokens) in each log message and adhere strictly to structured log levels (debug/info/warning).
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The sheer volume of debug/info logs—especially inside hot loops like file iteration and UI paint routines—could introduce performance overhead and clutter; consider auditing log levels and trimming verbosity in performance-critical paths.
- You’ve added many null-pointer and invalid-state checks with warnings; consolidating these guards into shared helper functions or macros would reduce boilerplate and ensure consistent error handling.
- To make post-mortem debugging easier, include consistent context (such as window IDs, URLs, or traversal tokens) in each log message and adhere strictly to structured log levels (debug/info/warning).
## Individual Comments
### Comment 1
<location> `src/plugins/filemanager/dfmplugin-workspace/utils/filedatamanager.cpp:33` </location>
<code_context>
return rootInfoMap.value(url);
+ }
+ fmInfo() << "Creating new RootInfo for URL:" << url.toString();
return createRoot(url);
}
</code_context>
<issue_to_address>
Filter root creation logs or guard by level
Consider filtering these logs or using `fmDebug` to prevent excessive info-level log output during frequent navigation.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
fmInfo() << "Creating new RootInfo for URL:" << url.toString();
=======
fmDebug() << "Creating new RootInfo for URL:" << url.toString();
>>>>>>> REPLACE
</suggested_fix>
### Comment 2
<location> `src/plugins/filemanager/dfmplugin-workspace/views/iconitemdelegate.cpp:58` </location>
<code_context>
{
Q_D(IconItemDelegate);
+ fmInfo() << "Creating IconItemDelegate";
+
d->expandedItem = new ExpandedItem(this, parent->parent()->viewport());
</code_context>
<issue_to_address>
Info-level log in constructor may be too coarse
Frequent delegate construction may clutter info logs; consider using `fmDebug()` for less verbosity.
</issue_to_address>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
||
fmInfo() << "Creating new RootInfo for URL:" << url.toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Filter root creation logs or guard by level
Consider filtering these logs or using fmDebug
to prevent excessive info-level log output during frequent navigation.
fmInfo() << "Creating new RootInfo for URL:" << url.toString(); | |
fmDebug() << "Creating new RootInfo for URL:" << url.toString(); |
@@ -55,12 +55,17 @@ IconItemDelegate::IconItemDelegate(FileViewHelper *parent) | |||
{ | |||
Q_D(IconItemDelegate); | |||
|
|||
fmInfo() << "Creating IconItemDelegate"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: Info-level log in constructor may be too coarse
Frequent delegate construction may clutter info logs; consider using fmDebug()
for less verbosity.
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Johnson-zs, Kakueeen 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 |
/forcemerge |
This pr force merged! (status: behind) |
Log: This commit enhances the logging and error handling mechanisms in the file manager, improving overall visibility and robustness during operations.
Summary by Sourcery
Enhance visibility and robustness of the file manager plugin by adding comprehensive logging and error checks across core components.
Bug Fixes:
Enhancements:
Chores: