contextx

package
v1.0.0-beta.236 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsCanceledError

func IsCanceledError(err error) bool

IsCanceledError recognizes cancellation causes in Go and gRPC error trees. Callers must also check their request context before treating the error as a client disconnect: a dependency can cancel its own context independently.

func NewLogHandler

func NewLogHandler(handler slog.Handler) slog.Handler

NewLogHandler returns a new slog.Handler

func WithAttr

func WithAttr(ctx context.Context, key string, value any) context.Context

WithAttr adds a key-value pair to the context.

func WithAttrs

func WithAttrs(ctx context.Context, data map[string]string) context.Context

ctxdata adds amultiple key-value pairs to the context.

Types

type Handler

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

func (Handler) Enabled

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

func (Handler) Handle

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

func (Handler) WithAttrs

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

func (Handler) WithGroup

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

Jump to

Keyboard shortcuts

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