Categorygithub.com/kuberlogic/zapsentry
modulepackage
1.6.2
Repository: https://github.com/kuberlogic/zapsentry.git
Documentation: pkg.go.dev

# README

Forked from TheZeroSlave/zapsentry

Improvements:

  • go 1.13
  • sentry-go v0.10.0
  • converting logger name to sentry logger
  • filtering k8s logger dependency - github.com/go-logr/zapr

Sentry client for zap logger

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

func modifyToSentryLogger(log *zap.Logger, DSN string) *zap.Logger {
	cfg := zapsentry.Configuration{
		Level: zapcore.ErrorLevel, //when to send message to sentry
		Tags: 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 it
	if err != nil {
		log.Warn("failed to init zap", zap.Error(err))
	}
	return zapsentry.AttachCoreToLogger(core, log)
}

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

Configuration is a minimal set of parameters for Sentry integration.

# Interfaces

No description provided by the author

# Type aliases

No description provided by the author