Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddSentryHook ¶
func AddSentryHook(log *logrus.Entry, configuration SentryConfiguration)
AddSentryHook registers logrus hook integration logger with Sentry
func ConfigureLogrus ¶
ConfigureLogrus defines global formatting, level and fields used while logging
Types ¶
type Logger ¶
type Logger interface { Warn(args ...interface{}) Warnf(format string, args ...interface{}) Error(args ...interface{}) Errorf(format string, args ...interface{}) }
Logger is a facade interface compatible with logrus.Logger but with limited scope of logging. It exists to decouple plugin implementations from particular log implementation but also to only allow reporting actionable problems and corner cases such as panic (or in other words to avoid logging as program flow analysis / debugging).
If needed this can be extended by adding other levels such as Panic or Fatal (both are exiting, former go-routine or the program if unwinding reaches the top of the goroutine stack, whereas latter terminates the program immediately)
func NewTestLogger ¶
func NewTestLogger() Logger
NewTestLogger creates a logger instance not logging any output to Out Writer unless "LOG_TESTS" environment variable is set to "true"
type SentryConfiguration ¶
type SentryConfiguration struct { Dsn string Tags SentryTags Timeout time.Duration }
SentryConfiguration keeps basic configuration used by sentry hook
func NewSentryConfiguration ¶
func NewSentryConfiguration(dsn string, tags map[string]string, timeout int) SentryConfiguration
NewSentryConfiguration creates new instance of SentryConfiguration dsn - full sentry DSN url tags - extra tags to add to every event reported to Sentry timeout - timeout in milliseconds after which connection to Sentry server should be dropped
type SentryTags ¶
SentryTags encapsulate map of tags where both key and values are strings. Those tags are used by Sentry to categorize events reported by client apps.