Documentation
¶
Overview ¶
Package sentrylogrus provides a simple Logrus hook for Sentry.
Index ¶
Constants ¶
View Source
const ( // These fields are simply omitted, as they are duplicated by the Sentry SDK. FieldGoVersion = "go_version" FieldMaxProcs = "go_maxprocs" LogrusOrigin = "auto.log.logrus" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FallbackFunc ¶
A FallbackFunc can be used to attempt to handle any errors in logging, before resorting to Logrus's standard error reporting.
type Hook ¶
type Hook interface {
// SetHubProvider sets a function to provide a hub for each log entry.
SetHubProvider(provider func() *sentry.Hub)
// AddTags adds tags to the hook's scope.
AddTags(tags map[string]string)
// SetFallback sets a fallback function for the eventHook.
SetFallback(fb FallbackFunc)
// SetKey sets an alternate field key for the eventHook.
SetKey(oldKey, newKey string)
// Levels returns the list of logging levels that will be sent to Sentry as events.
Levels() []logrus.Level
// Fire sends entry to Sentry as an event.
Fire(entry *logrus.Entry) error
// Flush waits until the underlying Sentry transport sends any buffered events.
Flush(timeout time.Duration) bool
// FlushWithContext waits for the underlying Sentry transport to send any buffered
// events, blocking until the context's deadline is reached or the context is canceled.
// It returns false if the context is canceled or its deadline expires before the events
// are sent, meaning some events may not have been sent.
FlushWithContext(ctx context.Context) bool
}
Hook is the logrus hook for Sentry.
It is not safe to configure the hook while logging is happening. Please perform all configuration before using it.
func NewLogHook ¶ added in v0.34.0
NewLogHook initializes a new Logrus hook which sends logs to a new Sentry client configured according to opts.
Click to show internal directories.
Click to hide internal directories.