logging

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConnID

func NewConnID() string

NewConnID returns a 16-character random hex string for per-connection tracing.

func ParseLevel

func ParseLevel(s string) (slog.Level, error)

ParseLevel converts a case-insensitive level name to slog.Level.

func ResolveLevel

func ResolveLevel(envVal, configVal string, defaultLevel slog.Level) (slog.Level, error)

ResolveLevel determines the effective log level. The environment variable (envVal) takes precedence over the config file value (configVal). If neither is set, defaultLevel is returned.

Types

type OTelHandler added in v0.6.1

type OTelHandler struct {
	// contains filtered or unexported fields
}

OTelHandler wraps a slog.Handler and injects OpenTelemetry trace context (trace_id, span_id, trace_flags) into log records when a valid span is present in the context.

func NewOTelHandler added in v0.6.1

func NewOTelHandler(inner slog.Handler) *OTelHandler

NewOTelHandler returns a handler that enriches log records with trace context.

func (*OTelHandler) Enabled added in v0.6.1

func (h *OTelHandler) Enabled(ctx context.Context, level slog.Level) bool

func (*OTelHandler) Handle added in v0.6.1

func (h *OTelHandler) Handle(ctx context.Context, record slog.Record) error

func (*OTelHandler) WithAttrs added in v0.6.1

func (h *OTelHandler) WithAttrs(attrs []slog.Attr) slog.Handler

func (*OTelHandler) WithGroup added in v0.6.1

func (h *OTelHandler) WithGroup(name string) slog.Handler

Jump to

Keyboard shortcuts

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