Skip to content

Add --grep to filter records by message - #1

Merged
Gulliby merged 1 commit into
mainfrom
feature/grep
Oct 11, 2026
Merged

Gulliby merged 1 commit into
mainfrom
feature/grep

Conversation

@Gulliby

@Gulliby Gulliby commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Before: you can only filter by time and level; finding one kind of message means piping the output through another tool, which loses --summary.

After: --grep PATTERN (a Python regular expression searched in the message) and -i/--ignore-case combine with the existing filters and with --summary. Without the options the output is unchanged.

logslice app.log --grep Disk
2026-10-10 12:01:00 ERROR Disk full

How: matches() in src/logslice/filters.py gets a keyword-only pattern; src/logslice/cli.py adds the two options and compiles the pattern before reading any input (invalid pattern: message on stderr, exit 2). README gains a usage example and two option rows.

Tests: 178 pass (159 before), ruff clean.

Built with BAKED (bench loop round 04)

Add --grep PATTERN (a Python regular expression searched in the message) and -i/--ignore-case. The filter combines with --since, --until, --level and --summary, so message searches no longer require piping through another tool and losing the summary. Invalid patterns exit with status 2. Output is unchanged without the new options.
@Gulliby
Gulliby merged commit ecf5f1c into main Oct 11, 2026
6 checks passed
@Gulliby
Gulliby deleted the feature/grep branch October 11, 2026 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant