slog

package
v0.1.24 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidLogFormat = errors.New("invalid log format")

ErrInvalidLogFormat is an error, which is returned when an invalid log format has been configured.

View Source
var ErrInvalidLogLevel = errors.New("invalid log level")

ErrInvalidLogLevel is an error, which is returned when an invalid log level has been configured.

Functions

func NewFromConfig

func NewFromConfig(w io.Writer, conf config.LoggingConfig) (*slog.Logger, error)

NewFromConfig creates a new slog.Logger based on the provided config.LoggingConfig spec. The returned logger outputs to the given io.Writer.

Types

type LogFormat

type LogFormat string

LogFormat represents the format of log events.

var (
	// FormatText specifies text log format.
	FormatText LogFormat = "text"
	// FormatJSON specifies JSON log format.
	FormatJSON LogFormat = "json"
)

type LogLevel

type LogLevel string

LogLevel represents the log level.

var (
	// LevelInfo specifies INFO log level.
	LevelInfo LogLevel = "info"
	// LevelWarn specifies WARN log level.
	LevelWarn LogLevel = "warn"
	// LevelError specifies ERROR log level.
	LevelError LogLevel = "error"
	// LevelDebug specifies DEBUG log level.
	LevelDebug LogLevel = "debug"
)

Jump to

Keyboard shortcuts

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