errorsctx

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package errorsctx provides ready to use generic consumer and slog handlers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

type Consumer struct {
	Layers []Layer
}

Consumer an implementation of errors.ErrorContextConsumer providing a tree view of the collected context grouped by layers of processing nodes.

func (*Consumer) Just

func (*Consumer) New

func (*Consumer) Wrap

type Layer

type Layer struct {
	Kind  LayerKind
	What  string
	Pos   string
	Pairs []slog.Attr
	// contains filtered or unexported fields
}

func (*Layer) Any

func (c *Layer) Any(name string, value any)

func (*Layer) Bool

func (c *Layer) Bool(name string, value bool)

func (*Layer) Finalize

func (c *Layer) Finalize()

func (*Layer) Flt64

func (c *Layer) Flt64(name string, value float64)

func (*Layer) Int64

func (c *Layer) Int64(name string, value int64)

func (*Layer) Loc

func (c *Layer) Loc(position string)

func (*Layer) Str

func (c *Layer) Str(name string, value string)

func (Layer) String

func (c Layer) String() string

func (*Layer) Uint64

func (c *Layer) Uint64(name string, value uint64)

type LayerKind

type LayerKind int
const (
	LayerKindNew LayerKind
	LayerKindWrap
	LayerKindJust
)

func (LayerKind) String

func (l LayerKind) String() string

type SLogHandlerFlat

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

SLogHandlerFlat handler for a flat view of an error context.

func NewSLogHandlerFlat

func NewSLogHandlerFlat(handler slog.Handler) *SLogHandlerFlat

func (*SLogHandlerFlat) Enabled

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

func (*SLogHandlerFlat) Handle

func (h *SLogHandlerFlat) Handle(ctx context.Context, r slog.Record) error

func (*SLogHandlerFlat) WithAttrs

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

func (*SLogHandlerFlat) WithGroup

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

type SLogHandlerTree

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

SLogHandlerTree handler for a tree view of an error context.

func NewSLogHandlerTree

func NewSLogHandlerTree(handler slog.Handler) *SLogHandlerTree

NewSLogHandlerTree creates handler SLogHandlerTree.

func (*SLogHandlerTree) Enabled

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

func (*SLogHandlerTree) Handle

func (h *SLogHandlerTree) Handle(ctx context.Context, r slog.Record) error

Handle handles errors.

func (*SLogHandlerTree) WithAttrs

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

func (*SLogHandlerTree) WithGroup

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

Jump to

Keyboard shortcuts

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