logger

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package logger provides structured slog-based logging with configurable output and an observer pattern for log forwarding.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

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

New constructs the shared runtime logger with JSON output and optional record observation hooks.

Types

type LogObserver

type LogObserver interface {
	Observe(context.Context, slog.Record)
}

LogObserver receives a clone of each log record that passes the handler's level filter.

type Option

type Option func(*config)

Option customizes logger construction.

func WithObserver

func WithObserver(observer LogObserver) Option

WithObserver receives records after level filtering and before write.

func WithWriter

func WithWriter(writer io.Writer) Option

WithWriter overrides the log destination. Tests use this to capture the JSON stream deterministically.

Jump to

Keyboard shortcuts

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