multilog

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

This section is empty.

Types

type Handler

type Handler struct {
	Level    slog.Level
	Handlers []slog.Handler
}

Handler is a log handler that forwards log records to multiple handlers. It is useful when you want to log to multiple destinations, e.g. console and opentelemetry.

func (Handler) Enabled

func (multi Handler) Enabled(ctx context.Context, level slog.Level) bool

Enabled returns true if the log level is enabled.

func (Handler) Handle

func (multi Handler) Handle(ctx context.Context, record slog.Record) error

Handle forwards the log record to all handlers.

func (Handler) WithAttrs

func (multi Handler) WithAttrs(attrs []slog.Attr) slog.Handler

WithAttrs returns a new Handler with the given attributes.

func (Handler) WithGroup

func (multi Handler) WithGroup(name string) slog.Handler

WithGroup returns a new Handler with the given group name.

Jump to

Keyboard shortcuts

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