sentry

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package sentry is a helper package for sentry integration

Index

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            bool    `split_words:"true" default:"false"`
	DSN                string  `split_words:"true"`
	ServerName         string  `split_words:"true"`
	Environment        string  `split_words:"true"`
	EnableTracing      bool    `split_words:"true" default:"false"`
	TracesSampler      float64 `split_words:"true" default:"1.0"`
	AttachStacktrace   bool    `split_words:"true" default:"true"`
	SampleRate         float64 `split_words:"true" default:"0.2"`
	TracesSampleRate   float64 `split_words:"true" default:"0.2"`
	ProfilesSampleRate float64 `split_words:"true" default:"0.2"`
	Repanic            bool    `ignored:"true"`
	Debug              bool    `default:"false"`
}

Config for the Sentry client

func (Config) ClientOptions

func (c Config) ClientOptions() sentry.ClientOptions

ClientOptions returns the sentry.ClientOptions for the configuration

func (Config) UsePerformanceTracking

func (c Config) UsePerformanceTracking() bool

UsePerformanceTracking tracking is enabled if Sentry is enabled and track performance is explicitly set

func (Config) UseSentry

func (c Config) UseSentry() bool

UseSentry true if Sentry is enabled (e.g. a DSN is configured)

func (Config) Validate

func (c Config) Validate() error

Validate the configuration

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

func (*SentryZapCore) Sync

func (s *SentryZapCore) Sync() error

Sync flushes the sentry event

func (*SentryZapCore) With

func (s *SentryZapCore) With(fields []zapcore.Field) zapcore.Core

With returns a new core with the fields added

func (*SentryZapCore) Write

func (s *SentryZapCore) Write(entry zapcore.Entry, fields []zapcore.Field) error

Write sends the log entry to sentry

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL