log

package
v1.27.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttrsFromMap

func AttrsFromMap(m map[string]any) []any

Types

type ContextExtractor

type ContextExtractor interface {
	Handle(context.Context, *slog.Record) error
}

type ContextExtractorFunction

type ContextExtractorFunction func(context.Context, *slog.Record) error

func (ContextExtractorFunction) Handle

func (cef ContextExtractorFunction) Handle(ctx context.Context, record *slog.Record) error

type ContextHandler

type ContextHandler struct {
	Next       slog.Handler
	Extractors []ContextExtractor
}

func (*ContextHandler) Enabled

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

func (*ContextHandler) Handle

func (contextHandler *ContextHandler) Handle(ctx context.Context, record slog.Record) error

func (*ContextHandler) WithAttrs

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

func (*ContextHandler) WithGroup

func (contextHandler *ContextHandler) WithGroup(name string) slog.Handler

type ErrorContextExtractor

type ErrorContextExtractor struct {
	SkipCause         bool
	SkipInput         bool
	SkipStackTrace    bool
	SkipOutput        bool
	ContextExtractors []ContextExtractor
}

func (*ErrorContextExtractor) Handle

func (extractor *ErrorContextExtractor) Handle(ctx context.Context, record *slog.Record) error

func (*ErrorContextExtractor) MakeErrorAttrs

func (extractor *ErrorContextExtractor) MakeErrorAttrs(err error) []any

Directories

Path Synopsis
journal_handler
Package journal_handler adapts slog to the systemd journal, recording each record as one journal entry whose priority follows the record's level.
Package journal_handler adapts slog to the systemd journal, recording each record as one journal entry whose priority follows the record's level.
Package http_logger makes the logger an HTTP service logs through: JSON entries carrying what is known about the request being logged, which the service's own logging calls need say nothing about.
Package http_logger makes the logger an HTTP service logs through: JSON entries carrying what is known about the request being logged, which the service's own logging calls need say nothing about.
Package journal writes entries to the local systemd journal over its native protocol.
Package journal writes entries to the local systemd journal over its native protocol.

Jump to

Keyboard shortcuts

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