log

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package log builds the slog handler the rest of the binary uses.

Output format:

  • "text" — human-friendly key=value lines (default in dev)
  • "json" — one JSON object per line (default in prod)

Standard log fields contract (every line):

  • time, level, msg
  • request_id when a request is in flight
  • user_id when known (post-S05)
  • component set by the package emitting the line
  • error/stack on error-level lines

Redaction: field values whose key matches a known secret pattern (token, password, key, dsn, authorization, otpauth) are rewritten to "***" before they hit the underlying handler.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts Options) *slog.Logger

New returns a slog.Logger configured per opts. The redacting handler wraps the chosen base handler so every record is sanitised before output.

Types

type Options

type Options struct {
	Level  string // debug | info | warn | error
	Format string // text | json
	Writer io.Writer
}

Options configures the handler.

Jump to

Keyboard shortcuts

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