Documentation ¶
Overview ¶
Package sentry is a helper package for sentry integration
Index ¶
- Variables
- func NewLogger() *zap.SugaredLogger
- type Config
- type SentryZapCore
- func (s *SentryZapCore) Check(entry zapcore.Entry, checkedEntry *zapcore.CheckedEntry) *zapcore.CheckedEntry
- func (s *SentryZapCore) Enabled(level zapcore.Level) bool
- func (s *SentryZapCore) Sync() error
- func (s *SentryZapCore) With(fields []zapcore.Field) zapcore.Core
- func (s *SentryZapCore) Write(entry zapcore.Entry, fields []zapcore.Field) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidConfiguration = errors.New("invalid configuration")
ErrInvalidConfiguration is returned when the configuration is invalid
Functions ¶
func NewLogger ¶
func NewLogger() *zap.SugaredLogger
NewLogger creates a new zap logger with the appropriate configuration based on the viper settings for pretty and debug
Types ¶
type Config ¶
type Config struct { // Enabled indicates whether the Sentry client is enabled Enabled bool `json:"enabled" koanf:"enabled" default:"false"` // DSN is the Data Source Name for the Sentry client DSN string `json:"dsn" koanf:"dsn"` // Environment is the environment in which the Sentry client is running Environment string `json:"environment" koanf:"environment" default:"development"` // EnableTracing indicates whether tracing is enabled for the Sentry client EnableTracing bool `json:"enableTracing" koanf:"enableTracing" default:"false"` // TracesSampler is the sampling rate for tracing in the Sentry client TracesSampler float64 `json:"traceSampler" koanf:"traceSampler" default:"1.0"` // AttachStacktrace indicates whether to attach stack traces to events in the Sentry client AttachStacktrace bool `json:"attachStacktrace" koanf:"attachStacktrace" default:"true"` // SampleRate is the sampling rate for events in the Sentry client SampleRate float64 `json:"sampleRate" koanf:"sampleRate" default:"0.2"` // TracesSampleRate is the sampling rate for tracing events in the Sentry client TracesSampleRate float64 `json:"traceSampleRate" koanf:"traceSampleRate" default:"0.2"` // ProfilesSampleRate is the sampling rate for profiling events in the Sentry client ProfilesSampleRate float64 `json:"profileSampleRate" koanf:"profileSampleRate" default:"0.2"` // Repanic indicates whether to repanic after capturing an event in the Sentry client Repanic bool `json:"repanic" koanf:"repanic" ignored:"true"` // Debug indicates whether debug mode is enabled for the Sentry client Debug bool `json:"debug" koanf:"debug" default:"false"` // ServerName is the name of the server running the Sentry client ServerName string `json:"serverName" koanf:"serverName"` }
Config settings for the Sentry client
func (Config) ClientOptions ¶
func (c Config) ClientOptions() sentry.ClientOptions
ClientOptions returns the sentry.ClientOptions for the configuration
func (Config) UsePerformanceTracking ¶
UsePerformanceTracking tracking is enabled if Sentry is enabled and track performance is explicitly set
type SentryZapCore ¶
type SentryZapCore struct {
// contains filtered or unexported fields
}
SentryZapCore is a zap core that sends logs to sentry
func (*SentryZapCore) Check ¶
func (s *SentryZapCore) Check(entry zapcore.Entry, checkedEntry *zapcore.CheckedEntry) *zapcore.CheckedEntry
Check returns a checked entry if the log level is enabled for the core
func (*SentryZapCore) Enabled ¶
func (s *SentryZapCore) Enabled(level zapcore.Level) bool
Enabled returns true if the log level is enabled
Click to show internal directories.
Click to hide internal directories.