logging

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EnvFormat controls the output handler format for structured logs.
	EnvFormat = "LOG_FORMAT"
	// EnvLevel controls the minimum severity level for structured logs.
	EnvLevel = "LOG_LEVEL"
)

Variables

This section is empty.

Functions

func BootstrapFromEnv

func BootstrapFromEnv(opts BootstrapOptions) (*slog.Logger, error)

BootstrapFromEnv loads logging config from env, installs the default logger, and returns it.

func NewLogger

func NewLogger(cfg Config, writer io.Writer, command string) *slog.Logger

NewLogger creates a structured logger with static Open-SSPM context attributes.

Types

type BootstrapOptions

type BootstrapOptions struct {
	Command string
	Writer  io.Writer
}

BootstrapOptions controls logger initialization behavior.

type Config

type Config struct {
	Format string
	Level  slog.Level
}

Config is the validated logging configuration derived from environment variables.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default structured logging configuration.

func LoadConfigFromEnv

func LoadConfigFromEnv() (Config, error)

LoadConfigFromEnv parses and validates logging environment variables.

Jump to

Keyboard shortcuts

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