Skip to content

Repository files navigation

Sentry client for zap logger

Go Report CardGodoc

Integration of sentry client into zap.Logger is pretty simple:

funcmodifyToSentryLogger(log*zap.Logger, DSNstring) *zap.Logger {
cfg:= zapsentry.Configuration{
Level: zapcore.ErrorLevel, //when to send message to sentryTags: map[string]string{
"component": "system",
},
}
core, err:=zapsentry.NewCore(cfg, zapsentry.NewSentryClientFromDSN(DSN))
//in case of err it will return noop core. so we can safely attach itiferr!=nil {
log.Warn("failed to init zap", zap.Error(err))
}
returnzapsentry.AttachCoreToLogger(core, log)
}

About

zap logger sentry core

Topics

Resources

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages