log

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2025 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(ctx context.Context, msg string, args ...any)

Debug logs a debug message with stack trace.

func Error

func Error(ctx context.Context, err error, args ...any)

Error logs an error message with call stack trace.

func Fatal

func Fatal(ctx context.Context, err error, args ...any)

Fatal logs a fatal message with call stack trace. It will call os.Exit(1) after logging.

func Info

func Info(ctx context.Context, msg string, args ...any)

Info logs an informational message with stack trace.

func SetLevel

func SetLevel(level Level) error

func SetWithStackLevel

func SetWithStackLevel(level slog.Level)

SetWithStackLevel sets the minimum log level that will include stack traces. It should not be called in init().

func Warn

func Warn(ctx context.Context, err error, args ...any)

Warn logs a warning message with stack trace.

func With

func With(ctx context.Context, keyvals ...any) context.Context

With returns a new context with additional labels added to the logger.

Types

type Level

type Level string
const (
	LevelDebug Level = "debug"
	LevelInfo  Level = "info"
	LevelWarn  Level = "warn"
	LevelError Level = "error"
)

Jump to

Keyboard shortcuts

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