Documentation
¶
Overview ¶
Package log is a temporary package until we forge our log structure.
Index ¶
- Constants
- func Debug(context context.Context, args ...interface{})
- func Debugf(context context.Context, format string, args ...interface{})
- func Error(context context.Context, args ...interface{})
- func Errorf(context context.Context, format string, args ...interface{})
- func Info(context context.Context, args ...interface{})
- func Infof(context context.Context, format string, args ...interface{})
- func InitJournalHandler(force bool)
- func IsLevelEnabled(level Level) bool
- func Notice(context context.Context, args ...interface{})
- func Noticef(context context.Context, format string, args ...interface{})
- func SetHandler(handler Handler)
- func SetLevelHandler(level Level, handler Handler)
- func SetOutput(out io.Writer)
- func Warning(context context.Context, args ...interface{})
- func Warningf(context context.Context, format string, args ...interface{})
- type Handler
- type Level
Constants ¶
const ( // ErrorLevel level. Logs. Used for errors that should definitely be noted. // Commonly used for hooks to send errors to an error tracking service. ErrorLevel = slog.LevelError // WarnLevel level. Non-critical entries that deserve eyes. WarnLevel = slog.LevelWarn // NoticeLevel level. Normal but significant conditions. Conditions that are not error conditions, but that may // require special handling. slog doesn't have a Notice level, so we use the average between Info and Warn. NoticeLevel = (slog.LevelInfo + slog.LevelWarn) / 2 // InfoLevel level. General operational entries about what's going on inside the application. InfoLevel = slog.LevelInfo // DebugLevel level. Usually only enabled when debugging. Very verbose logging. DebugLevel = slog.LevelDebug )
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
Debug outputs messages with the level DebugLevel (when that is enabled) using the configured logging handler.
func Debugf ¶
Debugf outputs messages with the level DebugLevel (when that is enabled) using the configured logging handler.
func Error ¶
Error outputs messages with the level ErrorLevel (when that is enabled) using the configured logging handler.
func Errorf ¶
Errorf outputs messages with the level ErrorLevel (when that is enabled) using the configured logging handler.
func Info ¶
Info outputs messages with the level InfoLevel (when that is enabled) using the configured logging handler.
func Infof ¶
Infof outputs messages with the level InfoLevel (when that is enabled) using the configured logging handler.
func InitJournalHandler ¶
func InitJournalHandler(force bool)
InitJournalHandler makes the log package print to the journal if stderr is connected to the journal.
func IsLevelEnabled ¶
IsLevelEnabled checks if the log level is greater than the level param.
func Notice ¶ added in v0.5.0
Notice outputs messages with the level NoticeLevel (when that is enabled) using the configured logging handler.
func Noticef ¶ added in v0.5.0
Noticef outputs messages with the level NoticeLevel (when that is enabled) using the configured logging handler.
func SetHandler ¶
func SetHandler(handler Handler)
SetHandler allows to define the default handler function for all log levels.
func SetLevelHandler ¶
SetLevelHandler allows to define the default handler function for a given level.