logging

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LevelTrace is a verbosity level below debug used for deep troubleshooting.
	LevelTrace = slog.Level(-8)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PeriodicStatsSnapshot added in v1.0.6

type PeriodicStatsSnapshot[T any] struct {
	Stats          T
	WindowStart    time.Time
	WindowEnd      time.Time
	WindowDuration time.Duration
}

PeriodicStatsSnapshot captures a flushed periodic stats window.

type PeriodicStatsWindow added in v1.0.6

type PeriodicStatsWindow[T any] struct {
	// contains filtered or unexported fields
}

PeriodicStatsWindow tracks stats samples and emits a snapshot at a bounded cadence.

When emitFirst is false, the first sample starts the cadence window and the first flush occurs once interval has elapsed.

When emitFirst is true, the first sample flushes immediately, then subsequent samples follow the interval cadence.

func NewPeriodicStatsWindow added in v1.0.6

func NewPeriodicStatsWindow[T any](emitFirst bool, mergeFn func(*T, T)) *PeriodicStatsWindow[T]

NewPeriodicStatsWindow builds a periodic tracker.

func (*PeriodicStatsWindow[T]) Record added in v1.0.6

func (w *PeriodicStatsWindow[T]) Record(now time.Time, interval time.Duration, sample T) (PeriodicStatsSnapshot[T], bool)

Record adds a sample into the pending window and returns a snapshot when the cadence interval is reached.

func (*PeriodicStatsWindow[T]) Reset added in v1.0.6

func (w *PeriodicStatsWindow[T]) Reset()

Reset clears pending samples and cadence state.

type Runtime

type Runtime struct {
	Logger      *slog.Logger
	LogFilePath string
	// contains filtered or unexported fields
}

Runtime contains the initialized logger and the backing log file metadata.

func New

func New(level, logDir string) (Runtime, error)

func (Runtime) Close

func (r Runtime) Close() error

Jump to

Keyboard shortcuts

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