logrus/hooks/sentry/README.md

853 B

Sentry Hook for Logrus :walrus:

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)
  }
}