logger

package
v0.0.0-...-7018970 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextHandler

type ContextHandler struct {
	slog.Handler
}

ContextHandler is a wrapper around slog.Handler that adds context information.

func NewContextHandler

func NewContextHandler(handler slog.Handler) *ContextHandler

NewContextHandler creates a new ContextHandler.

func (*ContextHandler) Enabled

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

Enabled reports whether the handler records at the given level.

func (*ContextHandler) Handle

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

Handle processes a log record and adds context information.

func (*ContextHandler) WithAttrs

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

WithAttrs returns a new ContextHandler with the given attributes added.

func (*ContextHandler) WithGroup

func (h *ContextHandler) WithGroup(group string) slog.Handler

WithGroup returns a new ContextHandler with the given group added.

Jump to

Keyboard shortcuts

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