-
Notifications
You must be signed in to change notification settings - Fork 353
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
[WIP] [Feature] Add some basic logging around request/response process. #511
base: main
Are you sure you want to change the base?
Conversation
…rrently problematic queries are difficult to debug, this should make it easier.
A thought: pyactiveresource has its own logging, perhaps we can take advantage of that instead of creating our own log statements? |
@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? |
Oh yes, sorry, fully support dropping pre 3.7 compatibility |
@@ -23,10 +24,14 @@ def __init__(self, site, user=None, password=None, timeout=None, format=formats. | |||
def _open(self, *args, **kwargs): | |||
self.response = None | |||
try: | |||
log.debug(f"Request: {args, kwargs}") |
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.
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
response = urllib.request.urlopen(request) | ||
logging.debug(f"Response: {response}") |
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.
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