sl

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextLoggerWithFields

func ContextLoggerWithFields(ctx context.Context, fields ...any) context.Context

ContextLoggerWithFields gets a logger with some fields pre-applied. deprecated, use `WithLogger(LoggerOf(ctx).With(fields...))`

func Error

func Error(err error) slog.Attr

func GetLoggerWithFields

func GetLoggerWithFields(ctx context.Context, fields ...any) *slog.Logger

GetLoggerWithFields gets a logger with some fields pre-applied. deprecated, use `LoggerOf(ctx).With(fields...)`

func LoggerOf

func LoggerOf(ctx context.Context) *slog.Logger

func WithLogger

func WithLogger(ctx context.Context, logger *slog.Logger) context.Context

WithLogger stores the entry into the context so it can be retrieved with LoggerOf later.

func WithTraceId

func WithTraceId(ctx context.Context, record slog.Record) (slog.Record, bool, error)

func Wrap

func Wrap(handler slog.Handler, middleware Middleware) slog.Handler

Types

type Middleware

type Middleware func(context.Context, slog.Record) (slog.Record, bool, error)

Jump to

Keyboard shortcuts

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