log

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AllLevel slog.Level = iota
	TraceLevel
	DebugLevel
	InfoLevel
	WarnLevel
	ErrorLevel
	FatalLevel
)

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, args ...any)

Log at DebugLevel

func Error

func Error(msg string, args ...any)

Log at ErrorLevel

func Fatal

func Fatal(msg string, args ...any)

Log at FatalLevel

func Info

func Info(msg string, args ...any)

Log at InfoLevel

func Init

func Init(lvl slog.Level, colored bool)

Initializes logging

func Log

func Log(level slog.Level, msg string, args ...any)

Log at given slog.Level

func Trace

func Trace(msg string, args ...any)

Log at TraceLevel

func Warn

func Warn(msg string, args ...any)

Log at WarnLevel

func WillTrace

func WillTrace() bool

WillTrace returns true if TraceLevel logs will be written

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(w io.Writer, level slog.Level) *Handler

func (*Handler) Enabled

func (h *Handler) Enabled(_ context.Context, level slog.Level) bool

func (*Handler) Handle

func (h *Handler) Handle(_ context.Context, r slog.Record) error

func (*Handler) WithAttrs

func (h *Handler) WithAttrs(attrs []slog.Attr) slog.Handler

func (*Handler) WithGroup

func (h *Handler) WithGroup(name string) slog.Handler

Jump to

Keyboard shortcuts

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