log

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromCtx

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

FromCtx returns a slog.Logger from the context, or the default slog.Logger. This is heavily adapted from slog-context.

func Info

func Info(ctx context.Context, msg string, args ...any)

func WithCtx

func WithCtx(parent context.Context, logger *slog.Logger) context.Context

WithCtx returns a context decorated with the non nil *slog.Logger.

Types

type TFHandler

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

func (*TFHandler) Enabled

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

Enabled implements slog.Handler.

func (*TFHandler) Handle

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

Handle implements slog.Handler.

func (*TFHandler) WithAttrs

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

WithAttrs implements slog.Handler.

func (*TFHandler) WithGroup

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

WithGroup implements slog.Handler.

type TFOption

type TFOption struct {
	// log level (default: info)
	Level slog.Leveler
}

func (TFOption) NewTFHandler

func (o TFOption) NewTFHandler() slog.Handler

Jump to

Keyboard shortcuts

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