Skip to content

Add the interactive log viewer - #3

Merged
autoantohaki merged 2 commits into
feat/filtersfrom
feat/viewer
Oct 22, 2026
Merged

autoantohaki merged 2 commits into
feat/filtersfrom
feat/viewer

Conversation

@autoantohaki

Copy link
Copy Markdown
Member

Before: Relay Logs could only print lines, so reading back through a busy log meant scrolling the terminal and searching with the terminal's own find.

After: in a terminal, relay-logs -f api.log worker.log opens a full-screen viewer. Each line shows its time, level, source, and message in aligned columns, and the newest line stays in view until you scroll up. Number keys 1–6 hide or show each level, / searches with a regular expression and highlights matches, n and N jump between them, and & shows only matching lines. The header shows which levels are visible, how many lines match, and whether the view is following or paused. ? opens the key reference.

Piped output, logs read from standard input, and --plain keep the plain line output, so scripts are unaffected.

How: LogBuffer keeps up to 50,000 entries and notifies the viewer in batches, so a burst of thousands of lines causes one render, not thousands. The viewer's logic lives in viewer/model.ts as plain functions (visible entries, selection, matches, window position) with their own tests. The selection is stored as the entry's sequence number, so it stays on the same line when new lines arrive, old ones are dropped, or a filter changes. The component is tested with ink-testing-library.

Not included: opening the viewer for logs piped on standard input, which needs the keyboard from /dev/tty and is left for a follow-up.

This branch is stacked on #2; please merge #1 and #2 first.

@autoantohaki
autoantohaki merged commit b786eeb into feat/filters Oct 22, 2026
12 checks passed
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