log-viewer

command
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2026 License: MIT Imports: 16 Imported by: 0

README

log-viewer

A journalctl-style live log viewer composed from nine glyph components. A steady stream of log entries flows across four sources (server, auth, ratelim, db); the operator filters by level, source, and substring, and can pause and resume the feed.

go run ./examples/log-viewer/

What's on screen

Component Where it shows up
status-bar top: live/paused mode, active filter, entry count
tabs level filter row: All / Info+ / Warn+ / Error+
log-stream middle: scrollable timestamped log feed
key-hints bottom: current-mode key bindings
notification-toast floating tray, top-right
theme every color in the layout

Overlays opened on demand

Key Overlay Components used
Ctrl-F source picker select
/ substring search prompt panel + text-input

Keys

Tab          cycle level filter (All → Info+ → Warn+ → Error+)
Shift-Tab    cycle backwards
Ctrl-F       open source picker (filter by component)
/            open substring search prompt
Space        pause / resume the live feed
Ctrl-L       clear the buffer
↑ / ↓        scroll the log
q / Ctrl-C   quit

How it composes

Each user action toggles state on the model and (when applicable) calls rebuildStream(), which clears the visible log-stream and re-appends only the entries matching the current level + source + query filter. The raw buffer (m.all) keeps every entry that ever ticked in, capped at 2000.

The pause behavior is a clean Bubble Tea idiom: the tick command keeps firing on a tea.Tick schedule, but the tickMsg branch in Update checks !m.paused before synthesizing new entries.

Tests

go test ./examples/log-viewer/

The test file exercises every binding headlessly: initial render, tick appending, pause, level cycling, source filter, substring search, clear, and quit.

Documentation

Overview

Command log-viewer is a journalctl-style live log viewer composed from nine glyph components: log-stream, tabs, status-bar, key-hints, select, notification-toast, text-input, panel, and theme.

The demo synthesizes a steady stream of log entries across four sources (server, auth, ratelim, db) and lets the operator filter by level (tabs at the top), filter by source (popover via Ctrl-S), search by substring (slash key opens a text-input prompt), pause/resume the live feed (Space), and clear the buffer (Ctrl-L).

What runs on screen at once:

  • status-bar at the top: live/paused mode, entry count, active filter
  • tabs row: All / Info+ / Warn+ / Error+ level filter
  • log-stream in the middle, scrollable
  • key-hints at the bottom
  • notification-toast tray, top-right

Overlays opened on demand:

  • select: source filter (Ctrl-F)
  • text-input + panel: substring search ('/')

Run it:

go run ./examples/log-viewer/

Quit at any time with Ctrl-C or q.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL