Documentation
¶
Overview ¶
Package logrusentry provides a simple Logrus hook for Sentry.
Deprecated: This package has been merged into the official sentry-go package. Use github.com/getsentry/sentry-go/logrus instead.
Index ¶
Constants ¶
const ( // FieldRequest holds an *http.Request. FieldRequest = "request" // FieldUser holds a User or *User value. FieldUser = "user" // FieldTransaction holds a transaction ID as a string. FieldTransaction = "transaction" // FieldFingerprint holds a string slice ([]string), used to dictate the // deduplication of this event FieldFingerprint = "fingerprint" // These fields are simply omitted, as they are duplicated by the Sentry SDK. FieldGoVersion = "go_version" FieldMaxProcs = "go_maxprocs" )
These default log field keys are used to pass specific metadata in a way that Sentry understands. If they are found in the log fields, and the value is of the expected datatype, it will be converted from a generic field, into Sentry metadata.
These keys may be overridden by calling SetKey on the hook object.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientOptions ¶
type ClientOptions = sentry.ClientOptions
ClientOptions is an alias for sentry.ClientOptions, and is all of the options available for configuring the sentry SDK client.
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 struct {
// contains filtered or unexported fields
}
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 New ¶
func New(levels []logrus.Level, opts ClientOptions) (*Hook, error)
New initializes a new Sentry hook.
func (*Hook) Fallback ¶
func (h *Hook) Fallback(fb FallbackFunc)
Fallback sets a fallback function, which will be called in case logging to sentry fails. In case of a logging failure in the Fire() method, the fallback function is called with the original logrus entry. If the fallback function returns nil, the error is considered handled. If it returns an error, that error is passed along to logrus as the return value from the Fire() call. If no fallback function is defined, a default error message is returned to Logrus in case of failure to send to Sentry.
func (*Hook) Flush ¶
Flush waits until the underlying Sentry transport sends any buffered events, blocking for at most the given timeout. It returns false if the timeout was reached, in which case some events may not have been sent.