logrus/formatter.go

16 lines
587 B
Go
Raw Normal View History

2014-03-10 23:22:08 +00:00
package logrus
2014-03-12 14:34:29 +00:00
// The Formatter interface is used to implement a custom Formatter. It takes an
// `Entry`. It exposes all the fields, including the default ones:
//
// * `entry.Data["msg"]`. The message passed from Info, Warn, Error ..
// * `entry.Data["time"]`. The timestamp.
// * `entry.Data["level"]. The level the entry was logged at.
//
// Any additional fields added with `WithField` or `WithFields` are also in
// `entry.Data`. Format is expected to return an array of bytes which are then
// logged to `logger.Out`.
2014-03-10 23:22:08 +00:00
type Formatter interface {
Format(*Entry) ([]byte, error)
}