slog

package
v0.74.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package slog provides an slog implementation of the LoggerInterface interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Disabled

func Disabled() types.LoggerInterface

Disabled returns a disabled logger.

func NewWrapper

func NewWrapper(handler slog.Handler) types.LoggerInterface

NewWrapper returns a new Wrapper implementing the LoggerInterface interface.

func NewWrapperWithCloseAndFlush

func NewWrapperWithCloseAndFlush(handler slog.Handler, flush func(), close func()) types.LoggerInterface

NewWrapperWithCloseAndFlush returns a new Wrapper implementing the LoggerInterface interface, with a flush and close function.

Types

type Wrapper

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

Wrapper is a wrapper around the slog.Handler interface. It implements the LoggerInterface interface.

func (*Wrapper) Close

func (w *Wrapper) Close()

Close flushes all the messages in the logger and closes it. It cannot be used after this operation.

func (*Wrapper) Critical

func (w *Wrapper) Critical(v ...interface{}) error

Critical formats message using the default formats for its operands and writes to log with level = Critical

func (*Wrapper) Criticalf

func (w *Wrapper) Criticalf(format string, params ...interface{}) error

Criticalf formats message according to format specifier and writes to log with level = Critical.

func (*Wrapper) Debug

func (w *Wrapper) Debug(v ...interface{})

Debug formats message using the default formats for its operands and writes to log with level = Debug

func (*Wrapper) Debugf

func (w *Wrapper) Debugf(format string, params ...interface{})

Debugf formats message according to format specifier and writes to log with level = Debug.

func (*Wrapper) Error

func (w *Wrapper) Error(v ...interface{}) error

Error formats message using the default formats for its operands and writes to log with level = Error

func (*Wrapper) Errorf

func (w *Wrapper) Errorf(format string, params ...interface{}) error

Errorf formats message according to format specifier and writes to log with level = Error.

func (*Wrapper) Flush

func (w *Wrapper) Flush()

Flush flushes all the messages in the logger.

func (*Wrapper) Info

func (w *Wrapper) Info(v ...interface{})

Info formats message using the default formats for its operands and writes to log with level = Info

func (*Wrapper) Infof

func (w *Wrapper) Infof(format string, params ...interface{})

Infof formats message according to format specifier and writes to log with level = Info.

func (*Wrapper) SetAdditionalStackDepth

func (w *Wrapper) SetAdditionalStackDepth(depth int) error

SetAdditionalStackDepth sets the additional number of frames to skip by runtime.Caller

func (*Wrapper) SetContext

func (w *Wrapper) SetContext(context interface{})

SetContext sets context which will be added to every log records

func (*Wrapper) Trace

func (w *Wrapper) Trace(v ...interface{})

Trace formats message using the default formats for its operands and writes to log with level = Trace

func (*Wrapper) Tracef

func (w *Wrapper) Tracef(format string, params ...interface{})

Tracef formats message according to format specifier and writes to log with level = Trace.

func (*Wrapper) Warn

func (w *Wrapper) Warn(v ...interface{}) error

Warn formats message using the default formats for its operands and writes to log with level = Warn

func (*Wrapper) Warnf

func (w *Wrapper) Warnf(format string, params ...interface{}) error

Warnf formats message according to format specifier and writes to log with level = Warn.

Directories

Path Synopsis
Package filewriter provides a rolling file writer.
Package filewriter provides a rolling file writer.
Package formatters provides functions to format log messages.
Package formatters provides functions to format log messages.
Package handlers provides simple slog handlers
Package handlers provides simple slog handlers

Jump to

Keyboard shortcuts

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