slog

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MPL-2.0 Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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