slog

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

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

Adapter is a slog adapter implementation

func New

func New(opts ...Option) *Adapter

func (*Adapter) Level added in v0.4.0

func (a *Adapter) Level() levels.Level

func (*Adapter) Log

func (a *Adapter) Log(level levels.Level, err error, logFields *fields.Fields, msg string, args ...any)

Log logs a message with the given level, error, fields, and message

func (*Adapter) Logger

func (a *Adapter) Logger() *slog.Logger

Logger returns the slog logger instance

func (*Adapter) SetLevel added in v0.4.0

func (a *Adapter) SetLevel(level levels.Level)

func (*Adapter) SetWriter added in v0.3.0

func (a *Adapter) SetWriter(w io.Writer)

func (*Adapter) Writer added in v0.3.0

func (a *Adapter) Writer() io.Writer

type Option

type Option func(*options)

Option defines the signature for the options.

func WithLevel

func WithLevel(level levels.Level) Option

WithLevel sets the log level for the logger.

func WithTrace added in v0.3.0

func WithTrace() Option

WithTrace sets the error trace for the logger.

func WithWriter

func WithWriter(writer io.Writer) Option

WithWriter sets the writer for the logger.

Jump to

Keyboard shortcuts

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