Log pane: text filter shows only matching lines — prologues are gated to level filters
Disclaimer: Everything after the image was written by AI.
We got this piece of feedback from an engineer:
Problem
Filtering the log pane by a search term (with level = All Levels) only shows the bare matching lines, with no context. This is nearly useless when logs are structured — e.g. pretty-printed JSON — because the matching line is often a single field of a larger record and carries no information about what request/entity it belongs to.
Example: searching for an order ID in JSON logs returns a wall of lines that look like this, over and over, with no way to tell which record each one came from:
"id": "01a00064-7eb4-8d00-b300-36131c1ae6db",
"01a00064-7eb4-8d00-b300-36131c1ae6db"
"id": "01a00064-7eb4-8d00-b300-36131c1ae6db",
"id": "01a00064-7eb4-8d00-b300-36131c1ae6db",
"01a00064-7eb4-8d00-b300-36131c1ae6db"
"id": "01a00064-7eb4-8d00-b300-36131c1ae6db",
"01a00064-7eb4-8d00-b300-36131c1ae6db"
"01a00064-7eb4-8d00-b300-36131c1ae6db",
"01a00064-7eb4-8d00-b300-36131c1ae6db",What's odd
Tilt already implements exactly this feature for level filters (Errors/Warnings) — a rolling buffer of preceding lines ("prologues") is shown before each match, with a divider and a "… (more) …" link back to the unfiltered view. It's just gated off for text search:
// web/src/logs.ts
shouldDisplayPrologues(): boolean {
return this.filterSet.level !== FilterLevel.all // ← term filters never get here
}So filtering by Errors gives 5 lines of lead-in per match; filtering by a term with All Levels gives none.
Proposal
Extend shouldDisplayPrologues() to also return true when a term filter is parsed, and reuse the existing prologue/grouping machinery (OverviewLogPane's isStartOfAlert/isEndOfAlert, currently keyed off level equality — needs a small tweak to work for terms too, since term matches don't share a level the way level-filtered matches do).
I have a small PR ready that does this (frontend-only, no Go changes) — opening it against this issue.
Source: tilt-dev/tilt