logger

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendSlogAttributesToCtx

func AppendSlogAttributesToCtx(ctx context.Context, attributes []slog.Attr) context.Context

Appends slog attributes to the given context. The modified context is then returned.

func Error

func Error(err error) slog.Attr

func InitLogger

func InitLogger(isDebugModeEnabled bool)

Initializes the logger.

Types

type ContextualSlogAttributesHandler

type ContextualSlogAttributesHandler struct {
	slog.Handler
}

func (*ContextualSlogAttributesHandler) Handle

Retrieves slog attributes present in the context and appends them to the slog record (log event). The slog handler is then invoked with the modified record. We do this to print out the contextual slog attributes.

type CustomTextHandler

type CustomTextHandler struct {
	// contains filtered or unexported fields
}

func NewCustomTextHandler

func NewCustomTextHandler(writer io.Writer, options *slog.HandlerOptions) *CustomTextHandler

func (*CustomTextHandler) Enabled

func (c *CustomTextHandler) Enabled(_ context.Context, logLevel slog.Level) bool

func (*CustomTextHandler) Handle

func (c *CustomTextHandler) Handle(_ context.Context, record slog.Record) error

func (*CustomTextHandler) WithAttrs

func (c *CustomTextHandler) WithAttrs(_ []slog.Attr) slog.Handler

func (*CustomTextHandler) WithGroup

func (c *CustomTextHandler) WithGroup(_ string) slog.Handler

type SlogAttributesCtxKey

type SlogAttributesCtxKey struct{}

Jump to

Keyboard shortcuts

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