Documentation ¶
Overview ¶
Package log provides utilities for logging
Index ¶
- Constants
- Variables
- type Level
- type LevelName
- type Logger
- func (l Logger) Debug(msg string)
- func (l Logger) Debugf(format string, a ...interface{})
- func (l Logger) Error(msg string)
- func (l Logger) Errorf(format string, a ...interface{})
- func (l Logger) Fatal(msg string)
- func (l Logger) Fatalf(format string, a ...interface{})
- func (l Logger) Info(msg string)
- func (l Logger) Infof(format string, a ...interface{})
- func (l Logger) Trace(msg string)
- func (l Logger) Tracef(format string, a ...interface{})
- func (l Logger) Warn(msg string)
- func (l Logger) Warnf(format string, a ...interface{})
Constants ¶
const DateFormat = "2006-01-02 15:04:05.000"
DateFormat describes how the date in a log message is formatted
const Format = "[{lvl}] [{name}] {date}: {message}"
Format describes how a log message is formatted
Variables ¶
var CutoffLevels = make(map[string]Level)
CutoffLevels maps the loggers by name to their cutoff level
var DateProvider = func() string { return time.Now().Format(DateFormat) }
DateProvider returns the formatted date as string, use by the logger
var DefaultCutoffLevel = LevelInfo
DefaultCutoffLevel is used as cutoff level for loggers with a name for whom no cutoff level is defined in CutoffLevels
var ErrorWriter io.Writer = os.Stderr
ErrorWriter is the writer to which Warn/Error/Fatal log messages are written
var LevelNames = map[Level]LevelName{ LevelTrace: {"TRACE", "TRC"}, LevelDebug: {"DEBUG", "DBG"}, LevelInfo: {"INFO", "INF"}, LevelWarn: {"WARN", "WRN"}, LevelError: {"ERROR", "ERR"}, LevelFatal: {"FATAL", "FTL"}, }
LevelNames contains the full and short names of the log levels
var OutputWriter io.Writer = os.Stdout
OutputWriter is the writer to which normal log messages are written (level < LevelWarn)
Functions ¶
This section is empty.
Types ¶
type Level ¶
type Level int
Level is a log level
noinspection GoUnusedConst The different log levels
func LevelByName ¶
LevelByName retrieves the level with the given name (defaults to LevelOff)
type Logger ¶
Logger is a function to log a single message