feat: capture logged errors and forward them to sentry when enabled
All checks were successful
Cadoles/bouncer/pipeline/head This commit looks good
All checks were successful
Cadoles/bouncer/pipeline/head This commit looks good
This commit is contained in:
@ -56,7 +56,7 @@ func newRedisClient(conf config.RedisConfig) redis.UniversalClient {
|
||||
|
||||
for range timer.C {
|
||||
if _, err := client.Ping(ctx).Result(); err != nil {
|
||||
logger.Error(ctx, "redis disconnected", logger.E(errors.WithStack(err)))
|
||||
logger.Error(ctx, "redis disconnected", logger.CapturedE(errors.WithStack(err)))
|
||||
connected = false
|
||||
continue
|
||||
}
|
||||
|
@ -34,6 +34,10 @@ func SetupSentry(ctx context.Context, conf config.SentryConfig, release string)
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
logger.SetCaptureFunc(func(err error) {
|
||||
sentry.CaptureException(err)
|
||||
})
|
||||
|
||||
flush := func() {
|
||||
sentry.Flush(time.Duration(*conf.FlushTimeout))
|
||||
}
|
||||
|
Reference in New Issue
Block a user