logz

package module
v0.0.0-...-08e24fc Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: GPL-3.0 Imports: 2 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogLevel

type LogLevel int
const (
	LogTrace LogLevel = iota
	LogDebug
	LogInfo
	LogWarn
	LogErr
	NoLogs
)

func ToLevel

func ToLevel(level string) (LogLevel, error)

ToLevel may be used to convert a string to the corresponding debug level, for example when parsing from environmento or command line.

func (LogLevel) Eq

func (level LogLevel) Eq(other LogLevel) bool

func (LogLevel) Ge

func (level LogLevel) Ge(other LogLevel) bool

func (LogLevel) Gt

func (level LogLevel) Gt(other LogLevel) bool

func (LogLevel) Le

func (level LogLevel) Le(other LogLevel) bool

func (LogLevel) Lt

func (level LogLevel) Lt(other LogLevel) bool

func (LogLevel) String

func (level LogLevel) String() string

type Logger

type Logger interface {
	Log(level LogLevel, data map[string]interface{})
	Trace(data map[string]interface{})
	Debug(data map[string]interface{})
	Info(data map[string]interface{})
	Warn(data map[string]interface{})
	Err(data map[string]interface{})
	SetLevel(LogLevel) Logger
}

Logger is the basic interface. All implementations provided by git.sr.ht/~blallo/logz must follow it.

func WithAttrs

func WithAttrs(logger Logger, attrs map[string]any) Logger

WithAttrs wraps a given logger and ensures that

Jump to

Keyboard shortcuts

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