Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix example: logrus.AddHook() args + add deferred flush #22

Merged
merged 1 commit into from
May 5, 2021

Conversation

angristan
Copy link
Contributor

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.

@onrik onrik merged commit fb0623d into onrik:master May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants