sentry

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DSNFieldName = "logger.sentry.dsn"
)

Variables

View Source
var Component = &app.Component{
	Dependencies: app.Components{
		logger.Component,
		configurator.Component,
	},
	Constructor: func(container container.Container) error {
		return container.Provides(
			NewConfig,
			NewWithConfigurator,
		)
	},
	BindFlags: func(flagSet *pflag.FlagSet, container container.Container) error {
		return container.Invoke(func(config *Config) {
			flagSet.StringVar(&config.DSN, DSNFieldName, "", "dsn to connect to the sentry")
		})
	},
	Run: func(c container.Container) error {
		return c.Invoke(func(sentryHook *logrusSentry.SentryHook, logger *logrus.Logger, config *Config) {
			logger.AddHook(sentryHook)
			logger.Info("logger: add hook sentry")
		})
	},
}
View Source
var DSNEmptyError = errors.New("logger.sentry: dsn empty")

Functions

func New

func New(config *Config) (*logrusSentry.SentryHook, error)

func NewWithConfigurator

func NewWithConfigurator(config *Config, configurator configurator.Configurator) (*logrusSentry.SentryHook, error)

Types

type Config

type Config struct {
	DSN string
}

func Configuration

func Configuration(config *Config, configurator configurator.Configurator) *Config

func NewConfig

func NewConfig() *Config

Jump to

Keyboard shortcuts

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