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

Use logger interface in recovery handler (#92) #94

Conversation

pavelnikolov
Copy link

@pavelnikolov pavelnikolov commented Dec 2, 2016

With this PR I would like to address (#92) and allow the recovery handler to accept interface instead of struct. Existing applications will still work, since the default logger implements this interface (already covered with unit tests).

This will allow developers to pass in a structured logger (e.g. Logrus), which can store some other fields (e.g. host, environment, service name etc.) in the message in addition to the panic. Also many applications log the output in JSON or some other format, which is easier to run queries against.

@pavelnikolov
Copy link
Author

Ping

@kisielk
Copy link
Contributor

kisielk commented Dec 5, 2016

Looks good to me apart from the name Logger. There may be other handlers that use a different logger interface. Maybe RecoveryHandlerLogger ?

@pavelnikolov pavelnikolov force-pushed the recovery-logger-interface-instead-of-struct branch from ca2fc92 to 3fda98c Compare December 6, 2016 05:50
@pavelnikolov
Copy link
Author

Done.

@kisielk kisielk merged commit 3a5767c into gorilla:master Dec 6, 2016
@kisielk
Copy link
Contributor

kisielk commented Dec 6, 2016

Cool. Thanks 👍

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.

None yet

2 participants