log

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const LevelTrace = slog.LevelDebug - 4

LevelTrace is a custom trace level for slog Using LevelDebug - 4 which equals -8

Variables

View Source
var HTTPLogContextKey = httpLogContextKey{}
View Source
var LoggerKey = Key{}

Functions

func ConfigLevelStringToSlogLevel

func ConfigLevelStringToSlogLevel(level string) slog.Level

func DisableErrorMirroring added in v0.2.0

func DisableErrorMirroring()

DisableErrorMirroring stops mirroring error level logs to the secondary handler. This is used for interactive commands where stderr output would disrupt the UI.

func EnableErrorMirroring added in v0.2.0

func EnableErrorMirroring()

EnableErrorMirroring ensures error level logs are mirrored to the secondary handler when one is configured.

func HTTPLogContextAttrs added in v0.5.0

func HTTPLogContextAttrs(ctx context.Context) []slog.Attr

HTTPLogContextAttrs converts context metadata to slog attributes.

func NewDualHandler added in v0.2.0

func NewDualHandler(primary slog.Handler, secondary slog.Handler) slog.Handler

NewDualHandler wraps a primary slog.Handler and, optionally, a secondary handler that only receives error level records when mirroring is enabled.

func NewFriendlyErrorHandler added in v0.3.2

func NewFriendlyErrorHandler(w io.Writer) slog.Handler

NewFriendlyErrorHandler returns a slog.Handler that renders error records in a concise, human-friendly format suitable for console output.

func WithHTTPLogContext added in v0.5.0

func WithHTTPLogContext(ctx context.Context, update HTTPLogContext) context.Context

WithHTTPLogContext merges non-empty fields from update into ctx.

Types

type HTTPLogContext added in v0.5.0

type HTTPLogContext struct {
	CommandPath    string
	CommandVerb    string
	CommandMode    string
	CommandProduct string

	Workflow          string
	WorkflowPhase     string
	WorkflowComponent string
	WorkflowMode      string
	WorkflowNamespace string
	WorkflowAction    string
	WorkflowChangeID  string
	WorkflowResource  string
	WorkflowRef       string

	SDKOperationID string
}

HTTPLogContext contains contextual metadata emitted with SDK HTTP logs.

func HTTPLogContextFromContext added in v0.5.0

func HTTPLogContextFromContext(ctx context.Context) HTTPLogContext

HTTPLogContextFromContext extracts HTTP logging metadata from ctx.

type Key

type Key struct{}

Jump to

Keyboard shortcuts

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