log

package module
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: MIT Imports: 12 Imported by: 4

Documentation

Index

Constants

View Source
const (
	LevelDebug    = slog.LevelDebug
	LevelInfo     = slog.LevelInfo
	LevelWarn     = slog.LevelWarn
	LevelError    = slog.LevelError
	LevelCritical = slog.Level(12)
	LevelFatal    = slog.Level(14)
)

Level is a wrapper around slog.Leveler. It adds some extra Levels, like Critical.

Variables

View Source
var (
	String = slog.String
	Int    = slog.Int
	Float  = slog.Float64
	Bool   = slog.Bool
	Any    = slog.Any
)

Attrs are wrappers around slog.Attr.

Functions

func Critical added in v1.3.0

func Critical(ctx context.Context, err error, attrs ...slog.Attr)

Critical logs critical data based on an error object.

func Criticalw added in v1.3.0

func Criticalw(ctx context.Context, msg string, attrs ...slog.Attr)

Criticalw logs critical data based on an error message.

func Debug added in v1.3.0

func Debug(ctx context.Context, msg string, attrs ...slog.Attr)

Debug logs debug data.

func Error added in v1.3.0

func Error(ctx context.Context, err error, attrs ...slog.Attr)

Error logs error data based on an error object.

func Errorw added in v1.3.0

func Errorw(ctx context.Context, msg string, attrs ...slog.Attr)

Errorw logs error data based on an error message.

func Fatal added in v1.4.0

func Fatal(ctx context.Context, err error, attrs ...slog.Attr)

Fatal logs fatal data based on an error object. It terminates the current goroutine.

DANGER: This function uses `runtime.Goexit()`. Therefore, if called within the main goroutine you MUST call `defer os.Exit(0)` at the top of the main function.

func Fatalw added in v1.4.0

func Fatalw(ctx context.Context, msg string, attrs ...slog.Attr)

Fatalw logs fatal data based on an error message. It terminates the current goroutine.

DANGER: This function uses `runtime.Goexit()`. Therefore, if called within the main goroutine you MUST call `defer os.Exit(0)` at the top of the main function.

func Info added in v1.3.0

func Info(ctx context.Context, msg string, attrs ...slog.Attr)

Info logs info data.

func SetContextKeySet added in v1.3.0

func SetContextKeySet(set propagation.ContextKeySet)

SetContextKeySet changes the logger context key set.

func SetLevel added in v1.3.0

func SetLevel(level slog.Level)

SetLevel changes the level of the logger.

func Warn added in v1.3.0

func Warn(ctx context.Context, msg string, attrs ...slog.Attr)

Warn logs warning data.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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