logger

package
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LevelDebug        = slog.LevelDebug
	LevelDebugName    = "debug"
	LevelInfo         = slog.LevelInfo
	LevelInfoName     = "info"
	LevelWarning      = slog.LevelWarn
	LevelWarningName  = "warning"
	LevelError        = slog.LevelError
	LevelErrorName    = "error"
	LevelCritical     = slog.Level(12)
	LevelCriticalName = "critical"
)

Variables

This section is empty.

Functions

func ErrAttr

func ErrAttr(err error) slog.Attr

ErrAttr returns an attribute for an error

func ParseLevel

func ParseLevel(s string) (slog.Level, error)

ParseLevel parses a string into a log level

Types

type Logger

type Logger struct {
	*slog.Logger
	Level slog.Level
}

func New

func New(logLevel slog.Level) *Logger

New returns a new Logger with the given log level

func (*Logger) Critical

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

Critical logs a message at the critical level and exits the application

Jump to

Keyboard shortcuts

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