LogLens: run a command, stream its output, filter each pattern into its own window. Rust, GPUI.
  • Rust 80.4%
  • CSS 19.6%
Find a file
Airi 00f54f7eb7
loglens: hover help, run state, keep-matched storage
- Tooltips on every control, in both window kinds and both themes. One
  TooltipOverlay per window; the box of a control is read in
  on_children_prepainted and given to TooltipRequest on hover. Tips wrap
  so they stay inside the window.
- Running indicator: a dot that flips twice a second plus the running
  time, in the status bar and in the header (RunManager::elapsed).
- keep: all / keep: matched. A run drops a line as it arrives when no
  open filter matches it (config keep_unmatched, PumpOptions,
  FilterState::matches_text, LogBuffer::note_discarded). 2 000 000 lines
  with 7 400 matches cost 0.5 MB of stored lines instead of 124 MB.
- Theme fixes: App::refresh_windows so every window repaints, the look is
  part of the list element id so cached rows redraw, and a filter window
  sends ToggleTheme to the main window, which now also saves the file.
- New flags: --theme=dark|light for one session, --bench --discard and
  --cap. Bench, selftest, and keytest use a scratch config in /tmp and
  remove it on exit.
- Tests: stderr capture moved to a case a small ring cannot evict
  (selftest, 54 checks), keep-matched through the window path (keytest
  AT-22, 21 checks). SPEC and README updated with the new FRs, NFR-111,
  AT-21, AT-22, and the framework traps found on the way.
2026-11-07 14:18:59 +00:00
assets/fonts wip: loglens working tree (ring buffer, selftest, bench) 2026-11-06 19:36:48 +00:00
design wip: loglens working tree (ring buffer, selftest, bench) 2026-11-06 19:36:48 +00:00
spike wip: loglens working tree (ring buffer, selftest, bench) 2026-11-06 19:36:48 +00:00
src loglens: hover help, run state, keep-matched storage 2026-11-07 14:18:59 +00:00
.gitignore loglens: keyboard wiring, headless tests, memory and docs work 2026-11-06 20:57:22 +00:00
build.rs loglens: hover help, run state, keep-matched storage 2026-11-07 14:18:59 +00:00
build.sh loglens: hover help, run state, keep-matched storage 2026-11-07 14:18:59 +00:00
Cargo.lock wip: loglens working tree (ring buffer, selftest, bench) 2026-11-06 19:36:48 +00:00
Cargo.toml wip: loglens working tree (ring buffer, selftest, bench) 2026-11-06 19:36:48 +00:00
README.md loglens: hover help, run state, keep-matched storage 2026-11-07 14:18:59 +00:00
SPEC.md loglens: hover help, run state, keep-matched storage 2026-11-07 14:18:59 +00:00

LogLens

LogLens runs a command, streams its output as log lines, and lets you open a separate window for each filter. Each filter window shows only the lines that match. The full specification is in SPEC.md.

What it does

  • You type a command. The program starts it and shows stdout and stderr as lines.
  • Each run starts a new buffer. Line numbers start again at 1.
  • You create filters. Each filter opens its own OS window with only its matches.
  • Filter windows stay open across runs and follow the new run.
  • You save a command with its filters as a profile, in TOML form.
  • A dot blinks and the status shows the running time while a command runs, so you can see the state from across the room.
  • Every control explains itself when you rest the pointer on it.
  • Long runs can keep only what matches: press keep: all to get keep: matched, and a line no filter matches never enters memory. With 2 000 000 lines and 7 400 matches, the stored lines cost 0.5 MB instead of 124 MB.
  • Dark theme follows vedal.ai. Light theme follows blog.neurosama.com.

Build

Rust 2021 toolchain. Linux needs X11 or Wayland development libraries.

cargo build
cargo build --release

A static Linux binary needs cargo-zigbuild and the build.sh script in this folder. build.rs adds the extra link libraries only when LOGLENS_STATIC_LINK=1 is set, so a normal build is unchanged.

Run the program:

./target/release/loglens          # main window
./target/release/loglens --demo   # a short sample run with one filter window

Config file: ~/.config/loglens/config.toml. The program keeps the previous copy if the file is not valid.

theme = "dark"          # or "light"
buffer_lines = 200000   # lines kept in memory
keep_unmatched = true   # false = drop lines no filter matches (keep: matched)

Start in a given look without touching the file:

./target/release/loglens --theme=light

Keyboard

Key Action
Ctrl+Enter Run the command
Ctrl+N New filter window
Ctrl+S Save the profile
Ctrl+L Clear the buffer
Ctrl+C Copy the selection, or stop the run when nothing is selected
Ctrl+Shift+C Copy the whole view
Ctrl+F Focus the command field
Ctrl+K Focus the profile name field
Ctrl+End Jump to the end and follow
Ctrl+Shift+D Switch dark and light
Ctrl+Q Quit
Esc Close the filter window that has focus

On macOS the program reads Ctrl as Cmd. The keys work in the main window and in every filter window.

Tests

cargo test                                  # unit tests
./target/debug/loglens --selftest           # pipeline, filters, config, stop
./target/debug/loglens --keytest            # keyboard map and window handlers
./target/release/loglens --bench --lines=200000 --windows=0
./target/release/loglens --bench --lines=1000000 --windows=3
./target/release/loglens --bench --lines=100000 --windows=20 --runs=3
./target/release/loglens --bench --lines=2000000 --windows=2 --cap=2000000 --discard

--bench flags: --windows=<n> filter windows, --runs=<n> repeats (the guard uses the best run), --cap=<n> line cap, --discard for keep: matched.

--selftest prints SELFTEST PASS (54 checks), --keytest prints KEYTEST PASS (21 checks), and --bench prints BENCH PASS. Each exits 0 on success. Each headless mode uses its own config file in /tmp, removes it before it starts and again when it exits, and never touches your real config.

The headless modes need a display. On a machine with no screen, use Xvfb:

Xvfb :99 -screen 0 1400x900x24 &
DISPLAY=:99 ./target/debug/loglens --selftest

For Wayland, a nested compositor works well for testing:

mkdir -p /tmp/weston-run
weston --backend=x11 --socket=wayland-2 --width=1100 --height=700 \
       --config=/tmp/weston.ini &      # [screen] lock-on-idle=false
WAYLAND_DISPLAY=wayland-2 XDG_RUNTIME_DIR=/tmp/weston-run \
       ./target/debug/loglens --selftest

Environment variables

Variable Effect
LOGLENS_CONFIG=<path> Use another config file. The tests use a file in /tmp.
LOGLENS_REPAINT_GAP_MS=<n> Shortest time between two repaints during fast output. Default 32. 0 repaints on every batch.
LOGLENS_TIME_START=1 Print FIRST_FRAME ms=<n> when the first frame is built.

Platform notes

  • Linux X11 and Linux Wayland are tested. macOS is supported by the framework but is not measured here.
  • Windows is out of scope for version 1.
  • The fonts are bundled in assets/fonts (Maple Mono NF, see assets/fonts/MAPLE-LICENSE.txt). The program loads them at start-up, so no font installation is needed.

Credits

  • Framework: gpui-kit 0.9 on gpui-base (the GPUI from Zed).
  • Dark theme colours from vedal.ai. Light theme colours from blog.neurosama.com.