mirror of https://github.com/sirupsen/logrus.git
4e014d4268 | ||
---|---|---|
.. | ||
README.md | ||
sentry.go | ||
sentry_test.go |
README.md
Sentry Hook for Logrus
Sentry provides both self-hosted and hostes solutions for exception tracking. Both client and server are open source.
Usage
Every sentry application defined on the server gets a different DNS. In the example below replace YOUR_DSN
with the one created for your application.
import (
"github.com/Sirupsen/logrus"
"github.com/Sirupsen/logrus/hooks/sentry"
)
func main() {
log := logrus.New()
hook, err := logrus_sentry.NewSentryHook(YOUR_DSN, []logrus.Level{
logrus.PanicLevel,
logrus.FatalLevel,
logrus.ErrorLevel,
})
if err == nil {
log.Hooks.Add(hook)
}
}