sentry

package
v1.5.7 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 12 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,
		re_configuration.Component,
		info.Component,
	},
	Constructor: func(container container.Container) error {
		return container.Provides(
			NewConfig,
			NewReConfigurationWithConfigurator,
		)
	},
	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 {
		sentryHook, err := container.Get[*ReConfiguration](c)
		if err != nil {
			return err
		}

		reConfiguration, err := container.Get[configurator.ReConfiguration](c)
		if err != nil {
			return err
		}

		logrus, err := container.Get[*logrus.Logger](c)
		if err != nil {
			return err
		}

		logrus.AddHook(sentryHook)
		logrus.Info("logger: add hook sentry")

		reConfiguration.Registration(sentryHook)
		logrus.Info("logger.sentry: registration in the reConfigurator")

		info, err := container.Get[info.Info](c)
		if err != nil {
			return err
		}

		config, err := container.Get[*Config](c)
		if err != nil {
			return err
		}

		info.Registration("logger.sentry", config)

		return nil
	},
}
View Source
var DSNEmptyError = errors.New("logger.sentry: dn 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

type ReConfiguration

type ReConfiguration struct {
	// contains filtered or unexported fields
}

func NewReConfiguration

func NewReConfiguration(informer logger.Informer, config *Config) (*ReConfiguration, error)

func NewReConfigurationWithConfigurator

func NewReConfigurationWithConfigurator(informer logger.Informer, config *Config, configurator configurator.Configurator) (*ReConfiguration, error)

func (*ReConfiguration) Fire

func (reConfiguration *ReConfiguration) Fire(entry *logrus.Entry) error

func (*ReConfiguration) Levels

func (reConfiguration *ReConfiguration) Levels() []logrus.Level

func (*ReConfiguration) ReConfiguration

func (reConfiguration *ReConfiguration) ReConfiguration(configurator configurator.Configurator) error

func (*ReConfiguration) SentryHook

func (reConfiguration *ReConfiguration) SentryHook() *logrusSentry.SentryHook

Jump to

Keyboard shortcuts

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