-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
caddyhttp: Wrap http.Server logging with zap #3668
Conversation
Hey this is pretty neat! Considering that the field is named |
Yeah I'm good with DEBUG level. I wanted to be conservative with it cause I wasn't sure where your opinion would lie.
Edit: Derp, I'm passing |
9537389
to
20870c1
Compare
Changed to use debug, pulled the logger setup out of the loop, should be slightly more efficient when running multiple servers, and passing it to the server wrapped by the http3 server as well.
Can also confirm the error is suppressed if the |
Good question about the namespace, I'm not sure... I wonder if we should specially namespace logs originating from the std lib, like, |
Yeah I don't mind that. I'm not sure how to do that though. How do we set it up with a different namespace? Do I need to make a new logger for that or something? |
Easy :) Just |
20870c1
to
d2698af
Compare
Okay cool:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
1fb19e3
to
4576574
Compare
I feel like we might as well get this into v2.2 since it's such a simple fix. |
4576574
to
5badac0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, might as well get this in then.
Well this was way simpler than I expected... went way down the rabbithole in the wrong direction then realized all we needed was this one liner.
See https://pkg.go.dev/go.uber.org/zap?tab=doc#NewStdLog
Right now, this will log all errors from
http.Server
as INFO level, but we can easily change that by usingNewStdLogAt
instead to specify the level. Not sure what level you think we should use. Warn? Error?This is how it looks before:
And after this change:
We may also want to make this change in other places like
admin.go
and theh3
server, i.e. where otherhttp.Server
s are created. This is the important one though.