Add watch mode and pretty structured rendering for access logs#324
Merged
nicobistolfi merged 1 commit intomainfrom Mar 26, 2026
Conversation
Add -w/--watch flag to `vigilante logs --access` that tails access.jsonl and renders new entries as they arrive. Decode each JSON line into a human-readable structured format showing timestamp, success/failure status, execution context, command with arguments, and duration. Malformed lines are surfaced with a [malformed] prefix instead of crashing the viewer. The -w flag is scoped to --access only; using it without --access produces a clear validation error. The persisted access.jsonl format is unchanged.
5 tasks
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.
Summary
-w/--watchflag tovigilante logs --accessthat tailsaccess.jsonland renders new entries as they arrive[malformed]prefix instead of crashing the viewer-wflag is scoped to--accessonly — using it without--accessproduces a clear validation erroraccess.jsonlformat remains unchangedChanged files
internal/app/logs.go— new file with access log renderer, watch mode, and duration formattinginternal/app/app.go— wire-w/--watchflag, use pretty rendering for--access, pass context to logs commandinternal/app/logs_test.go— new tests for renderer, watch/follow, malformed lines, flag validationinternal/app/app_test.go— update existing access log test for pretty output formatTest plan
TestFormatAccessLogEntry— verifies structured rendering of a successful entry with repo/issue detailsTestFormatAccessLogEntryFailure— verifies failure indicator and exit code displayTestFormatDuration— verifies ms/s/m formatting thresholdsTestRenderAccessLogLines— verifies multi-entry JSONL renderingTestRenderAccessLogLinesMalformed— verifies graceful handling of bad JSON linesTestRenderAccessLogLinesEmpty— verifies empty input produces no outputTestWatchAccessLogStopsOnContextCancellation— verifies clean shutdownTestWatchAccessLogMissingFile— verifies error for nonexistent logTestLogsWatchFlagRequiresAccess— verifies-wwithout--accessis rejectedTestLogsAccessWatchFlag— verifies end-to-end viaapp.RunTestWatchAccessLogPicksUpNewEntries— verifies tail behavior picks up appended entriesCloses #320