fix(logger): remove spurious debug prefix from cmd arrays in console#115
fix(logger): remove spurious debug prefix from cmd arrays in console#115water-sucks merged 1 commit intonix-community:mainfrom
Conversation
WalkthroughInternal refactoring of the console logger to separate command output routing. Adds a dedicated Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes The changes are localized to a single file with straightforward logic: one new field, simple initialization, and method behavior updates that redirect output to a dedicated logger. The refactoring is consistent and does not introduce complex interdependencies. Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
internal/logger/console.go (1)
129-130: Consider removing redundant color application for consistency.The
blue.Sprintfon line 129 applies blue coloring to the command text, but thecmdlogger already has a blue prefix. This is inconsistent with other log methods (Debug, Info, Warn, Error) which don't apply additional coloring beyond their prefixes.Apply this diff for consistency with other log methods:
- msg := blue.Sprintf("%v", utils.EscapeAndJoinArgs(argv)) - l.cmd.Printf("%v\n", msg) + l.cmd.Println(utils.EscapeAndJoinArgs(argv))This maintains the blue "$ " prefix while keeping the command text uncolored, consistent with how other log levels work.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
internal/logger/console.go(4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
internal/logger/console.go (2)
internal/logger/logger.go (1)
Logger(12-27)internal/utils/utils.go (1)
EscapeAndJoinArgs(27-41)
⏰ 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: Build/Test
🔇 Additional comments (3)
internal/logger/console.go (3)
20-20: LGTM! Good separation of concerns.Adding a dedicated
cmdlogger field properly separates command output from debug output, removing the spurious "debug:" prefix issue.
35-35: LGTM! Proper initialization.The cmd logger is correctly initialized with a blue "$ " prefix, consistent with the shell prompt convention.
155-155: LGTM! Proper prefix refresh.The cmd logger prefix is correctly updated in
RefreshColorPrefixes, ensuring the "$ " prompt maintains consistent coloring when colors are toggled on or off.
The
ConsoleLoggerused thedebugwriter for writing the output, which appended adebug:prefix to each array, which makes it look pretty dirty.This removes that and uses a separate writer for it.
Summary by CodeRabbit