logger

package
v0.0.2 Latest Latest
Warning

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

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

Documentation

Overview

Package logger provides the service's structured logger: a thin wrapper over log/slog so every package logs the same way and tests can silence output. The TS service used a hand-rolled leveled logger (src/logger.ts); the Go port standardizes on slog with the same level vocabulary (debug|info|warn|error).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(level Level) *slog.Logger

New returns a slog.Logger writing JSON to stderr at the given level. Unknown levels fall back to info (matching the TS oneOf default).

func NewTo

func NewTo(w io.Writer, level Level) *slog.Logger

NewTo is New with an explicit writer (used by tests that capture output).

func Silent

func Silent() *slog.Logger

Silent returns a logger that discards everything. The default for library-ish packages (usage emitter, auth) so a nil logger is never dereferenced and tests stay quiet.

Types

type Level

type Level string

Level is the configured log verbosity. Mirrors the TS LogLevel union.

const (
	LevelDebug Level = "debug"
	LevelInfo  Level = "info"
	LevelWarn  Level = "warn"
	LevelError Level = "error"
)

Jump to

Keyboard shortcuts

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