Uh oh!
There was an error while loading. Please reload this page.
[WIP] [Feature] Add some basic logging around request/response process. - #511
[WIP] [Feature] Add some basic logging around request/response process. #511samLozier wants to merge 1 commit into
Conversation
…rrently problematic queries are difficult to debug, this should make it easier.
mllemango
commented
Apr 19, 2021
A thought: pyactiveresource has its own logging, perhaps we can take advantage of that instead of creating our own log statements? |
samLozier
commented
Apr 21, 2021
@mllemango Thanks, I didn't realize that and will take a look. I suppose the question might be moot if I end up using the pyactiveresource logging, but any thoughts on the <3.7 compatibility question? |
mllemango
commented
Apr 21, 2021
Oh yes, sorry, fully support dropping pre 3.7 compatibility |
| def _open(self, *args, **kwargs): | ||
| self.response = None | ||
| try: | ||
| log.debug(f"Request: {args, kwargs}") |
There was a problem hiding this comment.
Hey @samLozier, I think it's better to use different patterns when you do log messages:log.debug("Request: %s, %s", args, kwargs).
Here is an article on that: https://google.github.io/styleguide/pyguide.html#3101-logging
| request = urllib.request.Request(url, urllib.parse.urlencode(query_params).encode("utf-8")) | ||
| log.debug(f"Request URL: {url}, query params: {query_params}") | ||
| response = urllib.request.urlopen(request) | ||
| logging.debug(f"Response: {response}") |
There was a problem hiding this comment.
I think you want to use log.debug(...) here instead.
Currently, problematic queries are difficult to debug, this should make slightly it easier.
WHY are these changes introduced?
PR is opened to address this discussion: #500
Fixes#500
Context about the problem that’s being addressed:
Adds some very rudimentary debug level logging in the session and base files.
Further discussion:
Checklist