slogutil

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2025 License: MPL-2.0 Imports: 8 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SliceInt64 added in v0.25.0

type SliceInt64 []int64

SliceInt64 is a type that implements slog.LogValue and which will format a slice for inclusion in logging, but lazily so that no work is done unless a log line is actually emitted.

func (SliceInt64) LogValue added in v0.25.0

func (s SliceInt64) LogValue() slog.Value

type SliceString added in v0.25.0

type SliceString []string

SliceString is a type that implements slog.LogValue and which will format a slice for inclusion in logging, but lazily so that no work is done unless a log line is actually emitted.

func (SliceString) LogValue added in v0.25.0

func (s SliceString) LogValue() slog.Value

type SlogMessageOnlyHandler

type SlogMessageOnlyHandler struct {
	Level slog.Level
	Out   io.Writer
}

SlogMessageOnlyHandler is a trivial slog handler that prints only messages. All attributes and groups are ignored. It's useful in example tests where it produces output that's normalized so we match against it (normally, all log lines include timestamps so it's not possible to have reproducible output).

func (*SlogMessageOnlyHandler) Enabled

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

func (*SlogMessageOnlyHandler) Handle

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

func (*SlogMessageOnlyHandler) WithAttrs

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

func (*SlogMessageOnlyHandler) WithGroup

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

Jump to

Keyboard shortcuts

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