slogutil

package
v0.4.3-final-apache Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SourceOverride

func SourceOverride(offset int) slog.Attr

SourceOverride returns a slog.Attr with the source of the caller at the given offset. SourceOverride(0) is the caller of SourceOverride, SourceOverride(1) is the caller of the caller, etc.

Types

type SourceRewriter

type SourceRewriter struct {
	slog.Handler
}

SourceRewriter is a slog.Handler that rewrites the source of log entries.

func NewSourceRewriter

func NewSourceRewriter(h slog.Handler) SourceRewriter

NewSourceRewriter returns a new SourceRewriter that wraps the given handler. The returned SourceRewriter applies the SourceOverride commands.

func (SourceRewriter) Handle

func (sr SourceRewriter) Handle(ctx context.Context, r slog.Record) error

func (SourceRewriter) WithAttrs

func (sr SourceRewriter) WithAttrs(attrs []slog.Attr) slog.Handler

WithAttrs implements slog.Handler.

func (SourceRewriter) WithGroup

func (sr SourceRewriter) WithGroup(name string) slog.Handler

WithGroup implements slog.Handler.

Jump to

Keyboard shortcuts

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