filter

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter struct {
	Level     string
	Grep      *regexp.Regexp
	Since     time.Time
	Until     time.Time
	ErrorOnly bool

	// Service, when non-empty, shows only entries from this source (e.g. "redis", "postgres").
	Service string

	// LevelExact: when true, Level filter shows only that level; when false (e.g. CLI --level), Level is minimum (level and above).
	LevelExact bool

	// Fields holds key=value pairs that must all match parsed log fields.
	// e.g. {"user_id": "42", "status": "500"}
	Fields map[string]string

	// Sample, when > 1, passes only every Nth matching entry.
	// The counter is internal — callers use Match() normally.
	Sample int
	// contains filtered or unexported fields
}

Filter holds the current filtering criteria.

func (*Filter) Match

func (f *Filter) Match(e source.LogEntry) bool

Match returns true if the entry passes all active filters. For sampling it maintains an internal counter; the counter only advances when all other criteria pass, so every Nth *qualifying* line is emitted rather than every Nth raw line.

func (*Filter) ToggleErrorOnly

func (f *Filter) ToggleErrorOnly()

ToggleErrorOnly flips the errors-only mode on/off.

Jump to

Keyboard shortcuts

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