From dbba57c402230607215d8846208b5b6f1f777bb5 Mon Sep 17 00:00:00 2001 From: Dave Date: Tue, 24 Feb 2026 17:33:35 +0000 Subject: [PATCH] story-kit: create 162_story_colored_server_terminal_log_output --- ...tory_colored_server_terminal_log_output.md | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .story_kit/work/1_upcoming/162_story_colored_server_terminal_log_output.md diff --git a/.story_kit/work/1_upcoming/162_story_colored_server_terminal_log_output.md b/.story_kit/work/1_upcoming/162_story_colored_server_terminal_log_output.md new file mode 100644 index 0000000..98f8116 --- /dev/null +++ b/.story_kit/work/1_upcoming/162_story_colored_server_terminal_log_output.md @@ -0,0 +1,32 @@ +--- +type: story +title: Colored server terminal log output +--- + +# Colored server terminal log output + +## Problem + +All server log lines printed to stderr via `slog!`, `slog_warn!`, and `slog_error!` appear in the same default terminal color. When scanning server output it's hard to spot warnings and errors at a glance — especially failed merge attempts. + +## Solution + +Add ANSI color codes to `push_entry()` in `server/src/log_buffer.rs` so that log lines printed to stderr are color-coded by severity: + +- **INFO** — default (no color) +- **WARN** — yellow/orange (`\x1b[33m`) +- **ERROR** — red (`\x1b[31m`) + +The color wrapping should only apply to the `eprintln!` output (line 78). The `LogEntry` stored in the ring buffer should remain uncolored so that `get_server_logs` MCP tool returns clean text. + +## Files to change + +- `server/src/log_buffer.rs` — `push_entry()` method (line ~78): replace `eprintln!("{line}")` with a match on `entry.level` that wraps the line in ANSI escape codes for WARN and ERROR. + +## Acceptance criteria + +- WARN logs appear in yellow/orange in the terminal +- ERROR logs appear in red in the terminal +- INFO logs remain default color +- Ring buffer entries remain free of ANSI escape codes +- Existing tests pass