logging

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package logging provides structured logging configuration using log/slog.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Setup

func Setup(cfg Config) *slog.Logger

Setup initializes the default slog logger with the given configuration.

Types

type Config

type Config struct {
	// Level is the minimum log level to output.
	Level slog.Level
	// JSON enables JSON output format (for production).
	JSON bool
	// Output is the writer to write logs to. Defaults to os.Stderr.
	Output io.Writer
}

Config holds logging configuration options.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a default logging configuration suitable for development. It reads the LOG_LEVEL environment variable to set the logging level. Valid values: DEBUG, INFO, WARN, ERROR. Defaults to INFO.

func ProductionConfig

func ProductionConfig() Config

ProductionConfig returns a logging configuration suitable for production.

Jump to

Keyboard shortcuts

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