log

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package log is a common spot for claircore logging.

Index

Constants

View Source
const (

	// AttrsKey is a common value to be used with [context.Context.Value] to
	// retrieve extra logging information from [slog.Record] values produced by
	// claircore packages.
	//
	// The value returned will be a [slog.Value] of kind "Group" if present.
	AttrsKey ctxkey

	// LevelKey is a common value to be used with [context.Context.Value] to
	// retrieve a per-record minimum [slog.Level] from [slog.Record] values
	// produced by claircore packages.
	LevelKey
)

Variables

This section is empty.

Functions

func With

func With(ctx context.Context, args ...any) context.Context

With returns a context with the arguments stored as slog.Attr at AttrsKey.

func WithAttr

func WithAttr(ctx context.Context, attrs ...slog.Attr) context.Context

WithAttr returns a context with the arguments stored at AttrsKey.

func WithLevel

func WithLevel(ctx context.Context, l slog.Leveler) context.Context

WithLevel returns a context with the slog.Leveler stored at LevelKey.

func WrapHandler

func WrapHandler(next slog.Handler) slog.Handler

WrapHandler wraps the provided handler with an interceptor that retrieves slog.Attr values from AttrsKey.

Types

This section is empty.

Jump to

Keyboard shortcuts

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