logger

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package logger configures AGH structured logging.

Index

Constants

This section is empty.

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.

Types

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