logger

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package logger configures Compozy structured logging.

Index

Constants

View Source
const FailureWarningInterval = 5 * time.Minute

Variables

This section is empty.

Functions

func MirrorToStderrEnabled

func MirrorToStderrEnabled(getenv func(string) string) bool

MirrorToStderrEnabled reports whether process-local logging should still be mirrored to stderr.

func New

func New(opts ...Option) (*slog.Logger, func() error, error)

New constructs a structured logger and returns a close function for any opened file handle.

func ParseLevel

func ParseLevel(raw string) (slog.Level, error)

ParseLevel converts the configured string level into slog's level type.

func WithMirrorToStderrEnv

func WithMirrorToStderrEnv(sandbox []string, enabled bool) []string

WithMirrorToStderrEnv sets the detached-process env override controlling stderr mirroring.

func WithRedaction

func WithRedaction(log *slog.Logger) *slog.Logger

WithRedaction wraps an injected logger with the process-snapshotted redaction engine.

Types

type FailureSample

type FailureSample struct {
	ID    string `json:"id"`
	Error string `json:"error"`
}

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

type FileRotationConfig struct {
	MaxSizeMB       int
	MaxBackups      int
	MaxAgeDays      int
	CompressBackups bool
}

FileRotationConfig configures the daemon log sink's file rotation policy.

type Option

type Option func(*options)

Option customizes logger construction.

func WithFile

func WithFile(path string) Option

WithFile enables JSON log output to the supplied file path.

func WithFileRotation

func WithFileRotation(rotation FileRotationConfig) Option

WithFileRotation enables lumberjack-backed rotation for the structured file sink.

func WithLevel

func WithLevel(level string) Option

WithLevel sets the slog level using the project config value.

func WithMirrorToStderr

func WithMirrorToStderr(enabled bool) Option

WithMirrorToStderr mirrors logs to stderr in addition to any file target.

Jump to

Keyboard shortcuts

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