log

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitLoggerFromEnv added in v0.14.0

func InitLoggerFromEnv()

Types

type SlogTextHandler

type SlogTextHandler struct {
	*slog.TextHandler
	// contains filtered or unexported fields
}

SlogTextHandler extends the standard slog.TextHandler to provide custom formatting that is very similar to the default slog handler. It prefixes each log entry with a right-padded level indicator and message, while excluding the default time, level, and message attributes from the structured output.

The output format is: LEVEL MESSAGE key1=value1 key2=value2

func NewSlogTextHandler

func NewSlogTextHandler(w io.Writer, opts *slog.HandlerOptions) *SlogTextHandler

func (*SlogTextHandler) Enabled

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

func (*SlogTextHandler) Handle

func (h *SlogTextHandler) Handle(ctx context.Context, r slog.Record) error

func (*SlogTextHandler) WithAttrs

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

func (*SlogTextHandler) WithGroup

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

Jump to

Keyboard shortcuts

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