Documentation
¶
Index ¶
- Constants
- func Crit(msg string, ctx ...interface{})
- func Debug(msg string, ctx ...interface{})
- func Error(msg string, ctx ...interface{})
- func Info(msg string, ctx ...interface{})
- func NewMultiHandler(handlers ...slog.Handler) slog.Handler
- func SetDefault(l Logger)
- func Warn(msg string, ctx ...interface{})
- type Level
- type Logger
- type MultiHandler
- type TerminalHandler
Constants ¶
View Source
const ( TerminalColourReset = "\033[0m" TerminalColourError = "\x1b[31m" TerminalColourWarn = "\x1b[33m" TerminalColourInfo = "\x1b[32m" TerminalColourDebug = "\x1b[36m" TerminalColourCrit = "\x1b[35m" TerminalColourKey = "\033[96m" TerminalTimeFormat = "2006-01-02 15:04:05" )
Variables ¶
This section is empty.
Functions ¶
func SetDefault ¶
func SetDefault(l Logger)
Types ¶
type Level ¶
type Level int
Level represents the logging level. -4: Debug 0: Info 4: Warn 8: Error 12: Critical
func LevelFromSlog ¶
func (Level) MarshalJSON ¶
func (Level) MarshalText ¶
func (Level) TerminalString ¶
func (*Level) UnmarshalJSON ¶
func (*Level) UnmarshalText ¶
type Logger ¶
type Logger interface {
Log(level Level, msg string, attrs ...any)
Debug(msg string, ctx ...interface{})
Info(msg string, ctx ...interface{})
Warn(msg string, ctx ...interface{})
Error(msg string, ctx ...interface{})
Crit(msg string, ctx ...interface{})
Handler() slog.Handler
Enabled(ctx context.Context, level Level) bool
With(ctx ...interface{}) Logger
WithGroup(name string) Logger
New(ctx ...interface{}) Logger
}
type MultiHandler ¶
type MultiHandler struct {
// contains filtered or unexported fields
}
type TerminalHandler ¶
type TerminalHandler struct {
// contains filtered or unexported fields
}
func NewTerminalHandler ¶
func NewTerminalHandler(writer io.Writer, level Level) *TerminalHandler
Click to show internal directories.
Click to hide internal directories.