-
Notifications
You must be signed in to change notification settings - Fork 270
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
RecoveryLogger
should accept interface instead of struct!
#92
Comments
I agree it probably should have used an interface. Not sure if changing that now would break existing code or not. I suspect it would be fine... |
It doesn't break anything. I'll submit a PR soon.
… On 24 Nov. 2016, at 10:27, Kamil Kisiel ***@***.***> wrote:
I agree it probably should have used an interface. Not sure if changing that now would break existing code or not. I suspect it would be fine...
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
pavelnikolov
pushed a commit
to pavelnikolov/handlers
that referenced
this issue
Dec 2, 2016
pavelnikolov
pushed a commit
to pavelnikolov/handlers
that referenced
this issue
Dec 6, 2016
kisielk
added a commit
that referenced
this issue
Dec 6, 2016
…stead-of-struct Use logger interface in recovery handler (#92)
Fixed by #94 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code is not designed well: https://github.com/gorilla/handlers/blob/master/recovery.go#L49
You should avoid accepting structs and instead try to accept interfaces whenever possible. In this particular case, since you are only using the
Println(...interface{})
method, you should create an interface for the input argument like this:This would allow users to pass a custom structured logger (e.g. Logrus), which might have some other fields/tags like environment, host, user, application etc. Unstructured logs in a highly distributed environment are totally useless.
The text was updated successfully, but these errors were encountered: