Documentation
¶
Overview ¶
Package logger configures Compozy structured logging.
Index ¶
- Constants
- func MirrorToStderrEnabled(getenv func(string) string) bool
- func New(opts ...Option) (*slog.Logger, func() error, error)
- func ParseLevel(raw string) (slog.Level, error)
- func WithMirrorToStderrEnv(sandbox []string, enabled bool) []string
- func WithRedaction(log *slog.Logger) *slog.Logger
- type FailureSample
- type FailureSummary
- type FailureWarnings
- type FileRotationConfig
- type Option
Constants ¶
const FailureWarningInterval = 5 * time.Minute
Variables ¶
This section is empty.
Functions ¶
func MirrorToStderrEnabled ¶
MirrorToStderrEnabled reports whether process-local logging should still be mirrored to stderr.
func New ¶
New constructs a structured logger and returns a close function for any opened file handle.
func ParseLevel ¶
ParseLevel converts the configured string level into slog's level type.
func WithMirrorToStderrEnv ¶
WithMirrorToStderrEnv sets the detached-process env override controlling stderr mirroring.
Types ¶
type FailureSample ¶
FailureSample is one bounded observation from a deterministic scan.
type FailureSummary ¶
type FailureSummary struct {
Count int
Samples []FailureSample
// contains filtered or unexported fields
}
FailureSummary retains a bounded sample while fingerprinting every failure in scan order.
func (*FailureSummary) Add ¶
func (s *FailureSummary) Add(id string, err error)
type FailureWarnings ¶
type FailureWarnings struct {
// contains filtered or unexported fields
}
FailureWarnings owns constant-space warning backoff for one scan source.
func (*FailureWarnings) Warn ¶
func (w *FailureWarnings) Warn(log *slog.Logger, message string, failures FailureSummary, now time.Time)
type FileRotationConfig ¶
FileRotationConfig configures the daemon log sink's file rotation policy.
type Option ¶
type Option func(*options)
Option customizes logger construction.
func WithFileRotation ¶
func WithFileRotation(rotation FileRotationConfig) Option
WithFileRotation enables lumberjack-backed rotation for the structured file sink.
func WithMirrorToStderr ¶
WithMirrorToStderr mirrors logs to stderr in addition to any file target.