slog

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

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

func Debug

func Debug() *Logger

func Default

func Default() *Logger

func New

func New(cfg *flog.Config, opts ...Option) *Logger

func (*Logger) Close

func (l *Logger) Close() error

func (*Logger) Debug

func (l *Logger) Debug(msg string, args ...any)

func (*Logger) DebugContext

func (l *Logger) DebugContext(ctx context.Context, msg string, args ...any)

func (*Logger) Error

func (l *Logger) Error(msg string, args ...any)

func (*Logger) ErrorContext

func (l *Logger) ErrorContext(ctx context.Context, msg string, args ...any)

func (*Logger) Handler

func (l *Logger) Handler() slog.Handler

func (*Logger) Info

func (l *Logger) Info(msg string, args ...any)

func (*Logger) InfoContext

func (l *Logger) InfoContext(ctx context.Context, msg string, args ...any)

func (*Logger) Named

func (l *Logger) Named(name string) *Logger

func (*Logger) Reopen

func (l *Logger) Reopen() error

func (*Logger) Warn

func (l *Logger) Warn(msg string, args ...any)

func (*Logger) WarnContext

func (l *Logger) WarnContext(ctx context.Context, msg string, args ...any)

func (*Logger) With

func (l *Logger) With(args ...any) flog.StructuredLogger

type Option

type Option func(*Logger)

func WithAttributes

func WithAttributes(args ...any) Option

WithAttributes allows to set custom attributes on the logger creation.

func WithOnError

func WithOnError(f func(name string)) Option

WithOnError allows to set a function that is called when an error is logged.

Jump to

Keyboard shortcuts

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