Documentation ¶
Index ¶
- Variables
- func AddFields(ctx context.Context, fields ...zapcore.Field)
- func NewLogger(GraylogEndpoint string, GraylogLevel, CLILevel Level) (*zap.Logger, error)
- func ToContext(ctx context.Context, logger *zap.Logger) context.Context
- func WithContext(ctx context.Context) *zap.Logger
- type GELFEncoder
- type GELFWriter
- type Level
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 GELFWriter ¶
type GELFWriter struct {
// contains filtered or unexported fields
}
GELFWriter is a writter following the GELF specs. It will write in udp using a gzip compression.
func NewGELFWriter ¶
func NewGELFWriter(addr string) (*GELFWriter, error)
NewGELFWriter will create a new GELFWriter. We expect a valid udp address.
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.