Repository navigation
Add the interactive log viewer - #3
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.logopens 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 keys1–6hide or show each level,/searches with a regular expression and highlights matches,nandNjump 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
--plainkeep the plain line output, so scripts are unaffected.How:
LogBufferkeeps 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 inviewer/model.tsas 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 withink-testing-library.Not included: opening the viewer for logs piped on standard input, which needs the keyboard from
/dev/ttyand is left for a follow-up.This branch is stacked on #2; please merge #1 and #2 first.