Skip to content

fix: sanitize characters in log output to prevent garbled log screen#116

Open
craigmayhew wants to merge 1 commit intomithun50:mainfrom
craigmayhew:fix/sanitize-log
Open

fix: sanitize characters in log output to prevent garbled log screen#116
craigmayhew wants to merge 1 commit intomithun50:mainfrom
craigmayhew:fix/sanitize-log

Conversation

@craigmayhew
Copy link
Copy Markdown
Contributor

@craigmayhew craigmayhew commented Apr 11, 2026

Summary

This PR sanitizes the log entries. This in turn improves the readability of the log view in the app. As a by-product it is also a micro optimization for memory usage.

before (with e.g. [90m) after (without!)
unsanitized sanitized

Summary by cubic

Sanitizes log output by stripping ANSI escape codes to prevent garbled characters in the log screen and improve readability. URL detection now runs on the sanitized text, with a slight memory win.

Written for commit 86ac28b. Summary will update on new commits.

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced log display by removing formatting codes from stored log messages.
    • Improved URL extraction reliability by sanitizing logs before pattern matching.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b76ee2bc-52d4-4a87-8aa1-2284ca238524

📥 Commits

Reviewing files that changed from the base of the PR and between 2a523ba and 86ac28b.

📒 Files selected for processing (1)
  • flutter_app/lib/services/gateway_service.dart

📝 Walkthrough

Walkthrough

ANSI escape sequences are now stripped from incoming log strings in the _subscribeLogs() method before being appended to logs and processed for URL extraction, ensuring cleaner log data handling.

Changes

Cohort / File(s) Summary
Log Sanitization
flutter_app/lib/services/gateway_service.dart
Added sanitization of incoming log strings by removing ANSI escape sequences using AppConstants.ansiEscape before storing in logs and extracting URLs. Changed _cleanForUrl(log) to _cleanForUrl(sanitizedLog) to use the cleaned output for URL reconstruction.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

Hops through the logs with a gentle care,
Whisking away codes that shouldn't be there,
ANSI escapes vanish—so neat, so clean,
The prettiest logs you've ever seen! 🐰✨

🚥 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 describes the main change: sanitizing ANSI escape sequences from log output to improve readability, which directly matches the code changes and visual improvements shown in the before/after comparison.
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.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-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.

No issues found across 1 file

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.

1 participant