log

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: GPL-3.0, LGPL-3.0 Imports: 2 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package log provides context-based structured logging.

The logger is injected into context at the CLI layer and extracted in pkg/ code via From. When no logger is present in the context, a no-op logger is returned. This design keeps logging local and injectable, allowing the slog backend to be replaced with a richer progress UI in the future without changing call sites.

Index

Constants

View Source
const LevelTrace = slog.Level(-8)

LevelTrace is a custom level below Debug for low-level diagnostics such as docker commands and probe retry attempts.

Variables

This section is empty.

Functions

func From

func From(ctx context.Context) *slog.Logger

From extracts the logger from the context. Returns a no-op logger if none is set, or the one set is nil.

func Warn added in v0.13.0

func Warn(ctx context.Context, msg string)

Warn reports a warning meant for the user, something that did not fail the operation but that its caller should know, such as a step that was skipped: to the function the context carries (WithWarn), or else, for a library caller that set none, to the context's logger at warn level.

func With

func With(ctx context.Context, l *slog.Logger) context.Context

With stores a logger in the context. A nil logger stands for none: From then returns the no-op logger.

func WithWarn added in v0.13.0

func WithWarn(ctx context.Context, warn func(msg string)) context.Context

WithWarn stores in the context where the warnings meant for the user go (Warn). The sind CLI prints each as a "Warning:" line on stderr. A nil warn stands for none: Warn then logs the warning.

Types

This section is empty.

Jump to

Keyboard shortcuts

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