logging

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package logging is where this module's logging is wired: the sink every package reports through, and the handler the CLI installs into it.

Nothing takes a logger as a parameter or holds one in a field. Most of this module is local computation — filtering, fingerprinting, parsing manifests, rendering SBOMs — with no client to hang a logger off, so a per-instance logger would reach a fraction of it. A single sink with a global setter covers all of it in one call. Logs go to stderr so stdout stays reserved for results/SBOM/JSON output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Configure

func Configure(verbose bool) *slog.Logger

Configure builds the CLI's handler on stderr, installs it as both the process default and this module's sink, and returns it. Debug when verbose, Warn otherwise, so a normal run stays quiet and only surfaces warnings and errors.

func Debug added in v0.8.0

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

Debug and Warn are what this module's packages call. There is no Info: a library has nothing to say about its normal operation that its consumer did not already ask for — that is Debug — and nothing between "working" and "something is wrong".

func Enabled added in v0.8.0

func Enabled(level slog.Level) bool

Enabled reports whether a record at level would be written. Use it to skip building arguments nobody will read — a per-file skip reason over a large tree, for one.

func Set added in v0.8.0

func Set(lg *slog.Logger)

Set routes this module's logs to lg. A nil lg restores silence.

The pointer swap is atomic, but a logger changed while calls are in flight can still split a run's output across two destinations. Call it during initialisation.

func Warn added in v0.8.0

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

Warn reports something the caller may want to act on but that did not stop the work.

Types

This section is empty.

Jump to

Keyboard shortcuts

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