logger

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package logger provides a structured slog-backed logger for spaniel. It picks a JSONHandler when stderr is not a TTY (production / CI) and a TextHandler otherwise (interactive development). Every subsystem should call With to attach a "subsystem" field so log lines can be filtered by component.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Default

func Default() *slog.Logger

Default returns the package-level default logger.

func Error

func Error(msg string, args ...any)

Error logs at ERROR level on the default logger.

func Info

func Info(msg string, args ...any)

Info logs at INFO level on the default logger.

func New

func New() *slog.Logger

New returns a fresh *slog.Logger wired to os.Stderr. The handler is chosen based on whether stderr looks like a terminal; callers that want a specific handler should build their own logger directly with slog.New.

func Warn

func Warn(msg string, args ...any)

Warn logs at WARN level on the default logger.

func With

func With(args ...any) *slog.Logger

With returns a logger derived from the package default with the given key-value pairs pre-attached. Typical use:

var log = logger.With("subsystem", "ingestion")

Types

This section is empty.

Jump to

Keyboard shortcuts

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