Documentation
¶
Overview ¶
Package log defines some simple functions for logging.
In your main.go file, use `log.SetLogger(&log.Config{})` to initialize the logger.
In other go files, use `log.Info("the log message", "key", "value")` to print the log messages.
Example:
log.SetLogger(&log.Config{
Level: "debug",
Format: "text",
Layout: "2006-01-02T15:04:05.000000Z",
NoCaller: false,
})
log.Info("the info log message", "key", "value")
log.Debug("the debug log message")
ctrLog := log.With("name", "controller")
ctrLog.Info("the info log message", "key", "value")
ctrLog.Debug("the debug log message")
Index ¶
- func Debug(msg string, keyvals ...interface{})
- func Error(msg string, keyvals ...interface{})
- func Fatal(msg string, keyvals ...interface{})
- func Info(msg string, keyvals ...interface{})
- func SetLogger(config *Config)
- func Warn(msg string, keyvals ...interface{})
- func With(keyvals ...interface{}) loggingT
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
func Debug(msg string, keyvals ...interface{})
Debug prints a msg and Key/DebugValue pair
func Error ¶
func Error(msg string, keyvals ...interface{})
Error prints a msg and Key/ErrorValue pair
func Fatal ¶
func Fatal(msg string, keyvals ...interface{})
Fatal prints a msg and Key/ErrorValue pair and exit
Types ¶
Click to show internal directories.
Click to hide internal directories.