slog

package
v2.0.24 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: Apache-2.0 Imports: 8 Imported by: 29

Documentation

Index

Constants

View Source
const (
	LevelDebug = level.Debug
	LevelInfo  = level.Info
	LevelWarn  = level.Warn
	LevelError = level.Error
	LevelFatal = level.Fatal
)

Variables

View Source
var (
	Group = slog.Group

	Any = slog.Any

	Bool     = slog.Bool
	Duration = slog.Duration
	Float64  = slog.Float64
	Int      = slog.Int
	Int64    = slog.Int64
	String   = slog.String
	Time     = slog.Time
	Uint64   = slog.Uint64
)
View Source
var (
	New        = logs.New
	SetDefault = logs.SetDefault

	OnFatal = func() { os.Exit(1) }
)

Functions

func AppendAttrs added in v2.0.22

func AppendAttrs(ctx context.Context, attrs ...Attr) context.Context

func Debug

func Debug(format string, argsAndAttrs ...any)

func Error

func Error(format string, argsAndAttrs ...any)

func Fatal

func Fatal(format string, argsAndAttrs ...any)

func Info

func Info(format string, argsAndAttrs ...any)

func Log

func Log(ctx context.Context, level Level, format string, argsAndAttrs ...any)

func Warn

func Warn(format string, argsAndAttrs ...any)

func WithAttrs added in v2.0.20

func WithAttrs(ctx context.Context, attrs ...Attr) context.Context

Types

type Attr

type Attr = slog.Attr

func GetAttrs added in v2.0.20

func GetAttrs(ctx context.Context) []Attr

type Level

type Level = level.Level

type Logger

type Logger = slog.Logger

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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