The levels have to be set earlier, otherwise the example can't run:
» go run main.go
# command-line-arguments
./main.go:27:13: too many arguments in call to logrus.AddHook
have (*"github.com/onrik/logrus/sentry".Hook, logrus.Level, logrus.Level, logrus.Level)
want (logrus.Hook)
Also, sentry-go flushes event asynchronously, so if we don't wait after the final log.Error(), the program will be terminated before the event is sent. I added a defer sentryHook.Flush() otherwise the example doesn't work.
The levels have to be set earlier, otherwise the example can't run:
Also,
sentry-go
flushes event asynchronously, so if we don't wait after the finallog.Error()
, the program will be terminated before the event is sent. I added adefer sentryHook.Flush()
otherwise the example doesn't work.