logrusbugsnag

package
v0.0.0-...-5720ada Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBugsnagUnconfigured = errors.New("bugsnag must be configured before installing this logrus hook")

ErrBugsnagUnconfigured is returned if NewBugsnagHook is called before bugsnag.Configure. Bugsnag must be configured before the hook.

Functions

This section is empty.

Types

type ErrBugsnagSendFailed

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

ErrBugsnagSendFailed indicates that the hook failed to submit an error to bugsnag. The error was successfully generated, but `bugsnag.Notify()` failed.

func (ErrBugsnagSendFailed) Error

func (e ErrBugsnagSendFailed) Error() string

type Hook

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

func NewBugsnagHook

func NewBugsnagHook(mp *MetadataProvider) (*Hook, error)

NewBugsnagHook initializes a logrus hook which sends exceptions to an exception-tracking service compatible with the Bugsnag API. Before using this hook, you must call bugsnag.Configure(). The returned object should be registered with a log via `AddHook()`

Entries that trigger an Error, Fatal or Panic should now include an "error" field to send to Bugsnag.

Optionally pass a MetadataProvider to inject other custom metadata

func (*Hook) Fire

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

Fire forwards an error to Bugsnag. Given a logrus.Entry, it extracts the "error" field (or the Message if the error isn't present) and sends it off.

func (*Hook) Levels

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

Levels enumerates the log levels on which the error should be forwarded to bugsnag: everything at or above the "Error" level.

type MetadataProvider

type MetadataProvider func(entry *logrus.Entry) bugsnag.MetaData

Jump to

Keyboard shortcuts

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