added logging to HTTP errors w/ url, status and response content#77
added logging to HTTP errors w/ url, status and response content#77andymccurdy wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
A library should not configure logging handlers. I would revert this.
There was a problem hiding this comment.
This is a common trick because the logging library is stupid and shoves messages to stderr if there are no handlers present.
There was a problem hiding this comment.
iow if you don't do this trick, then end users are forced to configure logging if they don't want spurious output.
There was a problem hiding this comment.
If zero handlers are present, Python will yell every time the log line is hit with "No handlers could be found for logger "slumber"".
I've seen the NullHandler pattern in quite a few libs. In fact, I borrowed the above code directly out of requests.
|
I'm fine using whatever log level you deem appropriate. Obviously an easy change. :) |
|
@merwok I agree with the error level. There is a "slumber" logger, so it's configurable. |
|
OK for the null handler. @pior: are you saying you agree with the proposed error level? |
This change adds a "slumber" logger and uses it to emit ERROR level messages w/ the URL, HTTP Status and response content in the event of an HTTP error. This should make it easier to debug server errors on the client side.