Filter and color emulator log lines#137
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughAdds log-level-aware processing and filtering, renders level-styled logs in a new interactive TUI, and wires the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI as CLI (logs)
participant UI as TUI.RunLogs
participant Gor as Goroutine
participant Container as container.Logs
participant Sink as Output Sink
participant Renderer as UI Renderer
User->>CLI: run `lstk logs`
CLI->>UI: RunLogs(ctx, rt, containers, follow)
UI->>UI: start Bubble Tea Program
UI->>Gor: launch goroutine for logs
Gor->>Container: container.Logs(ctx, sink, containers, follow)
Container->>Container: scan lines
Container->>Container: shouldFilter(line)?
alt filtered
Container-->>Sink: (skip)
else pass
Container->>Container: parseLogLine -> level
Container->>Sink: EmitLogLine(line, level)
Sink->>Renderer: deliver LogLineEvent(level, line)
Renderer->>UI: styled line
UI->>User: display
end
Container->>Gor: complete (done/error)
Gor->>UI: send completion message
UI->>User: exit TUI
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
📝 Coding Plan
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: 1
🧹 Nitpick comments (1)
internal/ui/logrender.go (1)
22-29: Prefer log-specific severity styles here.
styles.ErrorTitleis tied to the error panel and also brings title emphasis via bolding. A dedicated log severity style ininternal/ui/styles/styles.gowould keep inline log rendering decoupled from error-dialog styling. Based on learnings, "Define styles with semantic names in internal/ui/styles/styles.go."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/ui/logrender.go` around lines 22 - 29, The inline log renderer renderLogMessage currently uses styles.ErrorTitle (which is for the error panel and includes title emphasis); add a dedicated log-severity style in internal/ui/styles/styles.go (e.g., ErrorSeverity or LogError) and replace uses of styles.ErrorTitle in renderLogMessage with the new semantic style; ensure the new style mirrors appropriate color/weight for inline logs (but without title bolding) and update any imports/usages so renderLogMessage, styles.Warning, and the new styles.ErrorSeverity are used for Warn/Error cases respectively.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@internal/container/logs.go`:
- Around line 32-37: The code currently always drops lines via shouldFilter
before emitting them in the loop (see shouldFilter, parseLogLine, and
output.EmitLogLine), which makes filtered lines unrecoverable; instead gate that
filtering behind the new raw/verbose option: add a boolean parameter (e.g.,
rawLogs or verboseRaw) to the logs streaming function and only call shouldFilter
when that flag indicates filtering is enabled, or until the flag is plumbed in
keep plain mode unfiltered by skipping shouldFilter; ensure you propagate the
flag from the callers in cmd/logs.go and internal/ui/run_logs.go so the decision
is controlled by the CLI option rather than always dropping lines.
---
Nitpick comments:
In `@internal/ui/logrender.go`:
- Around line 22-29: The inline log renderer renderLogMessage currently uses
styles.ErrorTitle (which is for the error panel and includes title emphasis);
add a dedicated log-severity style in internal/ui/styles/styles.go (e.g.,
ErrorSeverity or LogError) and replace uses of styles.ErrorTitle in
renderLogMessage with the new semantic style; ensure the new style mirrors
appropriate color/weight for inline logs (but without title bolding) and update
any imports/usages so renderLogMessage, styles.Warning, and the new
styles.ErrorSeverity are used for Warn/Error cases respectively.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: a390f7b8-6d45-4b27-9206-570198d1ece3
📒 Files selected for processing (10)
cmd/logs.gointernal/container/logfilter.gointernal/container/logfilter_test.gointernal/container/logs.gointernal/output/events.gointernal/output/plain_format_test.gointernal/ui/app.gointernal/ui/logrender.gointernal/ui/run_logs.gointernal/update/update.go
silv-io
left a comment
There was a problem hiding this comment.
LGTM! improves the usability a lot IMO.
To make it better we can try pushing for structured logs in the emulator. it's something that was thought of earlier but didn't get through.
Also some of the comments maybe are more descriptive than explanatory
There was a problem hiding this comment.
nit: This one has a lot of comments in it :D
There was a problem hiding this comment.
Thanks 😆
Removed.
| // parseLogLine extracts the log level and logger name from a LocalStack log line. | ||
| // Expected format: 2026-03-16T17:56:00.810 INFO --- [ MainThread] l.p.c.extensions.plugins : message | ||
| // Returns LogLevelUnknown and empty string if the line does not match the expected format. | ||
| func parseLogLine(line string) (output.LogLevel, string) { |
There was a problem hiding this comment.
Maybe we should push for introducing structured logs again. This seems quite brittle, but it's the best we can do at the moment
There was a problem hiding this comment.
💯 log format could be configurable, plain text is better for humans but json would make it easier to parse them. However I think the biggest issue with the logs at the moment is the fact that are not consistent (some are formatted, others not)
|
added feature idea: shortcut to collapse the greyed out part :) |

Motivation
Raw emulator logs are noisy for users — they mix HTTP internals, provider debug info, and other low-signal lines with useful output. This filters out identified noise and adds color coding to make the remaining logs easier to scan.
Changes
localstack.request.http,l.aws.handlers.internal,*.providerloggers, and "Docker not available"Levelfield toLogLineEventso renderers can apply level-aware stylingrenderLogLinein the UI layer: metadata prefix in grey, message colored by level (WARN → orange, ERROR → red)lstk logsto TUI mode when running interactively, plain sink otherwiseTODO
Will add
--verboseflag to bypass the filtering in a subsequent PR.Closes DRG-589