Documentation ¶
Overview ¶
Package logger implements a new logger based on the zap lib.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var LevelsMap = map[string]zapcore.Level{ "EMERGENCY": zapcore.PanicLevel, "ALERT": zapcore.FatalLevel, "CRITICAL": zapcore.FatalLevel, "ERROR": zapcore.ErrorLevel, "WARNING": zapcore.WarnLevel, "NOTICE": zapcore.InfoLevel, "INFO": zapcore.InfoLevel, "DEBUG": zapcore.DebugLevel, }
LevelsMap is a map to Logrus log levels
Functions ¶
Types ¶
type GELFEncoder ¶
GELFEncoder is a gelf encoder. It will use an underlying json encoder to encode entries to the gelf format. See http://docs.graylog.org/en/2.4/pages/gelf.html.
func NewGELFEncoder ¶
func NewGELFEncoder() *GELFEncoder
NewGELFEncoder instanciate a new GELFEncoder.
func (GELFEncoder) Clone ¶
func (e GELFEncoder) Clone() zapcore.Encoder
Clone implements the encoder interface.
func (GELFEncoder) EncodeEntry ¶
func (e GELFEncoder) EncodeEntry(entry zapcore.Entry, fields []zapcore.Field) (*buffer.Buffer, error)
EncodeEntry escape the keys following the gelf spec, then the underlying encoder will encode the entry.
type Level ¶
Level implements the UnmarshalText Interface to be able to be load into the config. It is mainly used for parsing configuration with github.com/kelseyhightower/envconfig.
func (*Level) UnmarshalText ¶
UnmarshalText unmarshal a text to a level. Returns an error if no level match.