2014-02-24 04:50:42 +04:00
|
|
|
package logrus
|
2014-02-23 18:57:04 +04:00
|
|
|
|
2014-03-12 18:34:29 +04:00
|
|
|
// Fields type, used to pass to `WithFields`.
|
2014-03-11 03:22:08 +04:00
|
|
|
type Fields map[string]interface{}
|
2014-02-23 18:57:04 +04:00
|
|
|
|
2014-03-12 18:34:29 +04:00
|
|
|
// Level type
|
2014-03-11 03:52:39 +04:00
|
|
|
type Level uint8
|
2014-02-23 18:57:04 +04:00
|
|
|
|
2014-03-12 18:34:29 +04:00
|
|
|
// These are the different logging levels. You can set the logging level to log
|
|
|
|
// on your instance of logger, obtained with `logrus.New()`.
|
2014-02-23 18:57:04 +04:00
|
|
|
const (
|
2014-03-12 18:34:29 +04:00
|
|
|
// Panic level, highest level of severity. Logs and then calls panic with the
|
|
|
|
// message passed to Debug, Info, ...
|
2014-03-11 03:52:39 +04:00
|
|
|
Panic Level = iota
|
2014-03-12 18:34:29 +04:00
|
|
|
// Fatal level. Logs and then calls `os.Exit(1)`. It will exit even if the
|
|
|
|
// logging level is set to Panic.
|
2014-03-11 03:52:39 +04:00
|
|
|
Fatal
|
2014-03-12 18:34:29 +04:00
|
|
|
// Error level. Logs. Used for errors that should definitely be noted.
|
|
|
|
// Commonly used for hooks to send errors to an error tracking service.
|
2014-03-11 03:52:39 +04:00
|
|
|
Error
|
2014-03-12 18:34:29 +04:00
|
|
|
// Warn level. Non-critical entries that deserve eyes.
|
2014-03-11 03:52:39 +04:00
|
|
|
Warn
|
2014-03-12 18:34:29 +04:00
|
|
|
// Info level. General operational entries about what's going on inside the
|
|
|
|
// application.
|
2014-03-11 03:52:39 +04:00
|
|
|
Info
|
2014-03-12 18:34:29 +04:00
|
|
|
// Debug level. Usually only enabled when debugging. Very verbose logging.
|
2014-03-11 03:52:39 +04:00
|
|
|
Debug
|
2014-02-23 18:57:04 +04:00
|
|
|
)
|
|
|
|
|
|
|
|
// StandardLogger is what your logrus-enabled library should take, that way
|
|
|
|
// it'll accept a stdlib logger and a logrus logger. There's no standard
|
|
|
|
// interface, this is the closest we get, unfortunately.
|
|
|
|
type StandardLogger interface {
|
|
|
|
Print(...interface{})
|
|
|
|
Printf(string, ...interface{})
|
|
|
|
Printfln(...interface{})
|
|
|
|
|
|
|
|
Fatal(...interface{})
|
|
|
|
Fatalf(string, ...interface{})
|
|
|
|
Fatalln(...interface{})
|
|
|
|
|
|
|
|
Panic(...interface{})
|
|
|
|
Panicf(string, ...interface{})
|
|
|
|
Panicln(...interface{})
|
|
|
|
}
|