sbragi

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 9 Imported by: 24

Documentation

Index

Constants

View Source
const (
	LevelTrace   = slog.Level(-8)
	LevelDebug   = slog.LevelDebug
	LevelInfo    = slog.LevelInfo
	LevelNotice  = slog.Level(2)
	LevelWarning = slog.LevelWarn
	LevelError   = slog.LevelError
	LevelFatal   = slog.Level(12)
)

Variables

This section is empty.

Functions

func Debug

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

func Error

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

func Fatal

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

func Info

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

func LevelToString added in v0.7.5

func LevelToString(level slog.Level) string

func NewDebugLogger

func NewDebugLogger() (logger, error)

func NewHandlerInFolder

func NewHandlerInFolder(path string) (h fileHandler, err error)

func NewLogger

func NewLogger(handler slog.Handler) (logger, error)

func Notice

func Notice(msg string, args ...any) bool

func ReplaceAttr added in v0.7.5

func ReplaceAttr(groups []string, a slog.Attr) slog.Attr

func Trace

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

func Warning

func Warning(msg string, args ...any) bool

Types

type BaseLogger added in v0.7.5

type BaseLogger interface {
	Trace(msg string, args ...any) bool
	Debug(msg string, args ...any) bool
	Info(msg string, args ...any) bool
	Notice(msg string, args ...any) bool
	Warning(msg string, args ...any) bool
	Error(msg string, args ...any) bool
	Fatal(msg string, args ...any)
}

func WithError

func WithError(err error) BaseLogger

func WithErrorFunc

func WithErrorFunc(errf func() error) BaseLogger

type DefaultLogger

type DefaultLogger interface {
	BaseLogger
	WithError(err error) BaseLogger
	WithErrorFunc(errf func() error) BaseLogger
	WithoutEscalation() ErrorLogger
	WithLocalScope(defaultLevel slog.Level) ErrorLogger
}

func GetDefaultLogger added in v0.7.5

func GetDefaultLogger() DefaultLogger

type ErrorLogger

type ErrorLogger interface {
	BaseLogger
	WithError(err error) BaseLogger
	WithErrorFunc(errf func() error) BaseLogger
	WithoutEscalation() ErrorLogger
	SetDefault()
}

func WithLocalScope added in v0.7.5

func WithLocalScope(defaultLevel slog.Level) ErrorLogger

func WithoutEscalation

func WithoutEscalation() ErrorLogger

type RedactedString

type RedactedString string

func (RedactedString) LogValue

func (RedactedString) LogValue() slog.Value

func (RedactedString) String

func (r RedactedString) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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