tracking

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	SentryDSN string `mapstructure:"dsn"`
	// contains filtered or unexported fields
}

Config stores the configuration for the tracking.

func NewConfig

func NewConfig() (*Config, error)

NewConfig returns a new TrackingConfig instance.

type Hook

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

Hook is a service hook for the Logrus logger.

It's used for sending errors and messages to Sentry on specific log levels. It wraps a default Sentry client.

func NewSentryHook

func NewSentryHook(config *Config) (*Hook, error)

NewSentryHook creates a hook to be added to an instance of logger and initializes Sentry in package level. SentryHook will be triggered on Panic, Fatal and Error levels.

func (*Hook) AddTag

func (hook *Hook) AddTag(key, value string)

AddTag add a pair (key, value) in the map of tags attached to every Sentry Event handled by this hook.

func (*Hook) Fire

func (hook *Hook) Fire(entry *logrus.Entry) error

Fire uses the configured Sentry client to report the given Logrus Entry as Sentry Event.

func (*Hook) Levels

func (hook *Hook) Levels() []logrus.Level

Levels returns the list of Logrus levels for which this hook is configured to report errors.

func (*Hook) SetEnvironment

func (hook *Hook) SetEnvironment(environment string)

SetEnvironment sets the environment that every Sentry Event handled by this hook refers to.

func (*Hook) SetRelease

func (hook *Hook) SetRelease(release string)

SetRelease sets the release that every Sentry Event handled by this hook refers to.

func (*Hook) SetTags

func (hook *Hook) SetTags(tags map[string]string)

SetTags sets the given map of tags to every Sentry Event handled by this hook.

Jump to

Keyboard shortcuts

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