Skip to content

fix(log): Logging System Improvements and Error Handling Enhancements#994

Merged
lollipopkit merged 4 commits intolollipopkit:mainfrom
GT-610:log
Jan 7, 2026
Merged

fix(log): Logging System Improvements and Error Handling Enhancements#994
lollipopkit merged 4 commits intolollipopkit:mainfrom
GT-610:log

Conversation

@GT-610
Copy link
Copy Markdown
Collaborator

@GT-610 GT-610 commented Jan 7, 2026

This PR improves the logging system and error handling across the codebase. Key improvements include:

  • Fixed empty catch blocks by adding proper warning logs
  • Standardized debug output methods
  • Resolved duplicate log entries in the app's log page
  • i18n for log page UI

Before:
QQ_1767765513254

After:
QQ_1767767931572

Summary by CodeRabbit

  • Localization

    • Added "Logs" translation support across 13+ languages including English, German, Spanish, French, Indonesian, Japanese, Dutch, Portuguese, Russian, Turkish, Ukrainian, and Chinese variants.
    • Localized logs button text in settings menu.
  • Improvements

    • Enhanced error diagnostics and logging for better troubleshooting.
  • Chores

    • Removed unused dependencies.

✏️ Tip: You can customize this high-level summary in your review settings.

GT-610 added 4 commits January 7, 2026 11:32
Added detailed error logging to exception handling across multiple files, including exception information and stack traces, to facilitate troubleshooting.
Replace existing debugPrint and lprint with Loggers.app.warning to enhance logging consistency and maintainability.
Clean up unnecessary log print statements in debug code
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 7, 2026

Walkthrough

The PR enhances error handling across core and data model files by replacing generic catch blocks with specific exception and stack trace capture, adding structured warning logs via Loggers.app.warning. It simultaneously adds a new "logs" localization key across all 13 supported language files and updates the settings UI to use the localized label. The main logger initialization is simplified by removing a duplicate lprint call.

Changes

Cohort / File(s) Summary
Error Handling & Logging Improvements
lib/core/chan.dart, lib/core/service/ssh_discovery.dart, lib/core/sync.dart, lib/data/model/app/bak/backup_service.dart, lib/data/model/server/net_speed.dart, lib/data/model/server/server_status_update_req.dart, lib/data/model/sftp/req.dart, lib/data/provider/pve.dart
Replaced bare catch blocks (catch (_) or catch (e)) with catch (e, s) capturing both exception and stack trace; added Loggers.app.warning calls with contextual error messages. Control flow and success paths remain unchanged; error visibility improved.
Localization Files
lib/l10n/app_*.arb (13 files: de, en, es, fr, id, ja, nl, pt, ru, tr, uk, zh, zh_tw)
Added new public translation key "logs" with language-specific values (e.g., "Logs", "Protokolle", "Registros", etc.). Adjusted trailing commas in preceding entries to maintain valid JSON/ARB syntax. No semantic changes to existing translations.
Logging & UI
lib/main.dart, lib/view/page/setting/entry.dart
Removed duplicate lprint(record) call in logger initialization. Updated Logs button text in settings from hardcoded string to context-aware context.l10n.logs for localization consistency.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A hop through logs we now can trace,
With warnings caught in every place,
Thirteen tongues now sing "Logs" so bright,
Errors logged, no silent night!
ErrorHandling, localization—
All systems running toward perfection! 🌟

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main changes: logging system improvements through enhanced error handling with proper exception and stack trace logging across multiple files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom Pre-merge checks in the settings.


📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cc300c1 and 1b08887.

⛔ Files ignored due to path filters (13)
  • lib/generated/l10n/l10n.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_de.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_en.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_es.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_fr.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_id.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_ja.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_nl.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_pt.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_ru.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_tr.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_uk.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_zh.dart is excluded by !**/generated/**
📒 Files selected for processing (23)
  • lib/core/chan.dart
  • lib/core/service/ssh_discovery.dart
  • lib/core/sync.dart
  • lib/data/model/app/bak/backup_service.dart
  • lib/data/model/server/net_speed.dart
  • lib/data/model/server/server_status_update_req.dart
  • lib/data/model/sftp/req.dart
  • lib/data/provider/pve.dart
  • lib/l10n/app_de.arb
  • lib/l10n/app_en.arb
  • lib/l10n/app_es.arb
  • lib/l10n/app_fr.arb
  • lib/l10n/app_id.arb
  • lib/l10n/app_ja.arb
  • lib/l10n/app_nl.arb
  • lib/l10n/app_pt.arb
  • lib/l10n/app_ru.arb
  • lib/l10n/app_tr.arb
  • lib/l10n/app_uk.arb
  • lib/l10n/app_zh.arb
  • lib/l10n/app_zh_tw.arb
  • lib/main.dart
  • lib/view/page/setting/entry.dart
💤 Files with no reviewable changes (1)
  • lib/main.dart
🧰 Additional context used
📓 Path-based instructions (6)
lib/l10n/**/*.arb

📄 CodeRabbit inference engine (CLAUDE.md)

lib/l10n/**/*.arb: After modifying ARB files, run: flutter gen-l10n to regenerate localization
Keep localized strings in ARB files under lib/l10n/ (Flutter i18n)

Files:

  • lib/l10n/app_zh.arb
  • lib/l10n/app_ja.arb
  • lib/l10n/app_en.arb
  • lib/l10n/app_uk.arb
  • lib/l10n/app_ru.arb
  • lib/l10n/app_fr.arb
  • lib/l10n/app_nl.arb
  • lib/l10n/app_zh_tw.arb
  • lib/l10n/app_es.arb
  • lib/l10n/app_tr.arb
  • lib/l10n/app_pt.arb
  • lib/l10n/app_de.arb
  • lib/l10n/app_id.arb
lib/data/model/**/*.dart

📄 CodeRabbit inference engine (CLAUDE.md)

After modifying annotated model files, run: dart run build_runner build --delete-conflicting-outputs

Files:

  • lib/data/model/sftp/req.dart
  • lib/data/model/server/server_status_update_req.dart
  • lib/data/model/server/net_speed.dart
  • lib/data/model/app/bak/backup_service.dart
lib/data/model/sftp/**/*.dart

📄 CodeRabbit inference engine (CLAUDE.md)

Place SFTP models under lib/data/model/sftp/

Files:

  • lib/data/model/sftp/req.dart
lib/data/model/server/**/*.dart

📄 CodeRabbit inference engine (CLAUDE.md)

Place server management models under lib/data/model/server/

Files:

  • lib/data/model/server/server_status_update_req.dart
  • lib/data/model/server/net_speed.dart
lib/data/provider/**/*.dart

📄 CodeRabbit inference engine (CLAUDE.md)

Organize Riverpod providers by feature under lib/data/provider/

Files:

  • lib/data/provider/pve.dart
lib/view/**/*.dart

📄 CodeRabbit inference engine (CLAUDE.md)

lib/view/**/*.dart: Prefer widgets/utilities from fl_lib for common UI (e.g., CustomAppBar, context.showRoundDialog, Input, Btnx.cancelOk)
Prefer using libL10n strings before adding new ones to project l10n
Split UI into build, actions, and utils; use extension on to separate concerns

Files:

  • lib/view/page/setting/entry.dart
🧠 Learnings (8)
📚 Learning: 2025-10-08T09:36:41.682Z
Learnt from: CR
Repo: lollipopkit/flutter_server_box PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-08T09:36:41.682Z
Learning: Applies to lib/data/model/sftp/**/*.dart : Place SFTP models under lib/data/model/sftp/

Applied to files:

  • lib/data/model/sftp/req.dart
📚 Learning: 2025-10-08T09:36:41.682Z
Learnt from: CR
Repo: lollipopkit/flutter_server_box PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-08T09:36:41.682Z
Learning: Applies to lib/data/model/ssh/**/*.dart : Place SSH models under lib/data/model/ssh/

Applied to files:

  • lib/data/model/sftp/req.dart
  • lib/core/service/ssh_discovery.dart
📚 Learning: 2025-10-08T09:36:41.682Z
Learnt from: CR
Repo: lollipopkit/flutter_server_box PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-08T09:36:41.682Z
Learning: Applies to lib/l10n/**/*.arb : Keep localized strings in ARB files under lib/l10n/ (Flutter i18n)

Applied to files:

  • lib/l10n/app_en.arb
  • lib/l10n/app_uk.arb
  • lib/l10n/app_zh_tw.arb
  • lib/l10n/app_tr.arb
📚 Learning: 2025-10-08T09:36:41.682Z
Learnt from: CR
Repo: lollipopkit/flutter_server_box PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-08T09:36:41.682Z
Learning: Applies to lib/data/provider/**/*.dart : Organize Riverpod providers by feature under lib/data/provider/

Applied to files:

  • lib/data/provider/pve.dart
📚 Learning: 2025-10-08T09:36:41.682Z
Learnt from: CR
Repo: lollipopkit/flutter_server_box PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-08T09:36:41.682Z
Learning: Applies to lib/data/model/server/**/*.dart : Place server management models under lib/data/model/server/

Applied to files:

  • lib/data/provider/pve.dart
📚 Learning: 2025-10-08T09:36:41.682Z
Learnt from: CR
Repo: lollipopkit/flutter_server_box PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-08T09:36:41.682Z
Learning: Applies to lib/view/**/*.dart : Prefer widgets/utilities from fl_lib for common UI (e.g., CustomAppBar, context.showRoundDialog, Input, Btnx.cancelOk)

Applied to files:

  • lib/data/provider/pve.dart
📚 Learning: 2025-10-08T09:36:41.682Z
Learnt from: CR
Repo: lollipopkit/flutter_server_box PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-08T09:36:41.682Z
Learning: Use Riverpod with code generation (riverpod_annotation) for state management

Applied to files:

  • lib/data/provider/pve.dart
📚 Learning: 2025-10-08T09:36:41.682Z
Learnt from: CR
Repo: lollipopkit/flutter_server_box PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-08T09:36:41.682Z
Learning: Applies to lib/view/**/*.dart : Prefer using libL10n strings before adding new ones to project l10n

Applied to files:

  • lib/data/provider/pve.dart
  • lib/view/page/setting/entry.dart
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: check
🔇 Additional comments (26)
lib/data/model/server/net_speed.dart (1)

167-168: LGTM! Enhanced error handling improves debugging.

The addition of exception and stack trace logging provides valuable debugging information while preserving the control flow to skip malformed network interface data.

lib/data/model/app/bak/backup_service.dart (1)

77-78: LGTM! Clear fallback handling with informative logging.

The warning log clearly explains the failure and intended fallback behavior (prompting the user for manual password input), which aids in debugging while maintaining the correct control flow.

lib/l10n/app_es.arb (1)

296-297: Ensure flutter gen-l10n is executed locally after ARB modifications.

The logs localization key has been correctly added to lib/l10n/app_es.arb. After modifying ARB files, the generated localization files must be regenerated locally by running flutter gen-l10n to ensure all supported languages include the new key.

lib/l10n/app_tr.arb (1)

296-297: LGTM! New localization key added correctly.

The addition of the "logs" key with Turkish translation "Günlükler" is properly formatted and aligns with the PR's i18n improvements for the log page UI.

Reminder: As per coding guidelines, please run flutter gen-l10n after modifying ARB files to regenerate localization code.

lib/data/model/sftp/req.dart (1)

22-27: Excellent error handling improvement!

The change from a silent catch to capturing and logging the exception with stack trace significantly improves debuggability while maintaining the existing fallback behavior. This aligns perfectly with the PR's objective to add proper warning logs to empty catch blocks.

lib/l10n/app_zh_tw.arb (1)

296-297: LGTM! New localization key added correctly.

The addition of the "logs" key with Traditional Chinese translation "日誌" is properly formatted and consistent with the localization updates across all language files in this PR.

Reminder: As per coding guidelines, please run flutter gen-l10n after modifying ARB files to regenerate localization code.

lib/core/sync.dart (1)

24-33: Well-implemented error handling enhancement!

The change from a bare catch to capturing exception and stack trace with structured logging provides valuable visibility when backup file parsing fails, while preserving the fallback behavior to try parsing without a password. This is consistent with the PR's broader error handling improvements.

lib/data/provider/pve.dart (2)

110-110: Good logging standardization.

The change from debugPrint to dprint (from fl_lib) standardizes debug output methods across the codebase, aligning with the PR's objective to improve logging consistency.


234-246: Excellent error handling improvements in cleanup code!

The enhanced error handling in the dispose method provides valuable visibility when cleanup operations fail. Previously, exceptions during socket and forward cleanup were silently suppressed, which could mask resource leaks or other issues. Now both operations log detailed warnings with stack traces while allowing cleanup to continue for remaining resources.

lib/core/chan.dart (3)

38-40: LGTM! Enhanced error logging for Android sessions.

The replacement of the silent catch block with structured exception and stack trace logging significantly improves debuggability for Android session update failures.


49-52: LGTM! Improved error visibility for service status checks.

The error handling now logs failures while maintaining the original control flow (returning false on exceptions).


61-63: LGTM! Consistent error logging for iOS Live Activity operations.

All three Live Activity methods now properly capture and log exceptions with stack traces, replacing the previous silent catch blocks.

Also applies to: 71-73, 81-83

lib/core/service/ssh_discovery.dart (4)

77-80: LGTM! Enhanced error handling for external process execution.

The structured exception logging provides valuable context when command execution fails, replacing the previous silent catch.


113-116: LGTM! Added platform-specific warnings for parsing failures.

These warnings improve observability for macOS-specific parsing issues (ARP entries, ifconfig format) without altering control flow.

Also applies to: 180-181, 193-194


252-254: LGTM! Improved error visibility for mDNS discovery.

The exception logging helps diagnose Bonjour/mDNS discovery failures on macOS.


340-342: LGTM! SSH probe failures are now logged.

The structured logging captures connection failures per host, improving debugging while maintaining graceful degradation (returning null).

lib/l10n/app_pt.arb (1)

296-297: [Rewritten review comment]
[Classification tag]

lib/l10n/app_en.arb (1)

306-307: LGTM! Added English localization for logs feature.

The new "logs" key and trailing comma properly support the internationalized log page UI.

As per coding guidelines, regenerate localizations after modifying ARB files:

flutter gen-l10n
lib/l10n/app_zh.arb (1)

303-304: LGTM! Added Chinese localization for logs feature.

The translation "日志" is correct and the trailing comma maintains valid ARB/JSON structure.

As per coding guidelines, regenerate localizations after modifying ARB files:

flutter gen-l10n
lib/l10n/app_ru.arb (1)

296-297: LGTM! Localization addition is correct.

The trailing comma on Line 296 and the new "logs" key are properly formatted. The Russian translation "Журналы" is appropriate.

As per coding guidelines, remember to run flutter gen-l10n after modifying ARB files to regenerate localization.

lib/view/page/setting/entry.dart (1)

74-76: LGTM! Proper localization implementation.

The changes correctly replace hard-coded "Logs" text with the localized string via context.l10n.logs, ensuring the UI displays the appropriate translation across all supported locales.

lib/l10n/app_id.arb (1)

296-297: LGTM! Indonesian localization is correct.

The trailing comma and new "logs" key are properly formatted. The Indonesian translation "Log" is the standard term used in Indonesian tech contexts.

lib/l10n/app_ja.arb (1)

296-297: LGTM! Japanese localization improvements.

Line 296 improves the writeScriptTip translation wording, and Line 297 adds the new "logs" key with the appropriate Japanese translation "ログ" (katakana for "log"), which is the standard term in Japanese tech contexts.

lib/l10n/app_uk.arb (1)

296-297: LGTM! Ukrainian localization is correct.

The trailing comma and new "logs" key are properly formatted. The Ukrainian translation "Журнали" is appropriate and correctly distinguishes from the similar Russian term.

lib/data/model/server/server_status_update_req.dart (1)

682-683: LGTM! Improved error observability for Windows temperature parsing.

The change from a silent catch to structured warning logging aligns with the PR objectives and maintains the existing error-recovery behavior while adding visibility into parsing failures.

lib/l10n/app_de.arb (1)

296-297: I'm ready to verify and rewrite the review comment. Please provide the review comment within <review_comment> tags so I can begin the verification process.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@lollipopkit lollipopkit merged commit 2c495a4 into lollipopkit:main Jan 7, 2026
2 checks passed
@GT-610 GT-610 deleted the log branch January 7, 2026 07:49
@GT-610
Copy link
Copy Markdown
Collaborator Author

GT-610 commented Jan 7, 2026

@lollipopkit Can you add my name to the contributors list? Thanks a lot!

@lollipopkit
Copy link
Copy Markdown
Owner

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.

2 participants