Skip to content

Latest commit

 

History

History
17 lines (12 loc) · 424 Bytes

README.md

File metadata and controls

17 lines (12 loc) · 424 Bytes

Sentry hook for Logrus

Example usage:

hook := lhs.New("dsn", "environment")
hook.SetLevels([]logrus.Level{logrus.WarnLevel, logrus.ErrorLevel}) // Error, Fatal, Panic by default

err := hook.Init()
if err != nil {
    logger.WithError(err).Error("cannot init sentry")
}

logger.AddHook(hook)

Hook retrieves fields from WithField() functions and sends data to Sentry alongside error message and stack trace.