Skip to content
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

feat: Add extensive loggers #29

Merged
merged 4 commits into from
Oct 10, 2024
Merged

Conversation

Ashutosh619-sudo
Copy link
Contributor

No description provided.



logger = logging.getLogger(__name__)
logger.level = logging.WARNING
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not required

@@ -246,6 +253,8 @@ def _post_request(self, data, api_url):
if response.status_code == 200:
result = json.loads(response.text)
return result

logger.debug('Response for post request: %s', response.text)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's do logger.info for all non 2xx status code

logger.debug you can move it to 2xx block

@@ -9,6 +9,11 @@
from ..exceptions import WrongParamsError, InvalidTokenError, QuickbooksOnlineSDKError, \
NoPrivilegeError, NotFoundItemError, ExpiredTokenError, InternalServerError

import logging
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to top

@@ -9,6 +9,11 @@
from ..exceptions import WrongParamsError, InvalidTokenError, QuickbooksOnlineSDKError, \
NoPrivilegeError, NotFoundItemError, ExpiredTokenError, InternalServerError

import logging

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls bump version as well

@@ -118,11 +117,14 @@ def _query_get_all_generator(self, object_type: str, url: str) -> Generator[Dict
if not query_response or object_type not in query_response:
break

logger.debug('Response for get request for url: %s, %s', url, query_response)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

print response.text - I don't want any data to be missed

except requests.exceptions.HTTPError as err:
logger.info('Response for get request for url: %s, %s', url, err.response)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

err.response.text

@@ -242,19 +248,19 @@ def _post_request(self, data, api_url):
'Authorization': 'Bearer {0}'.format(self.__access_token)
}

logger.debug('Payload for post request: %s', data)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's log this as well

@@ -259,7 +259,7 @@ def _post_request(self, data, api_url):
result = json.loads(response.text)
return result

logger.info('Payload for post request: %s', data)
logger.debug('Payload for post request: %s', data)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be before 257 block, we don't end up reaching here since we're returning at 260

@Ashutosh619-sudo Ashutosh619-sudo merged commit 72a4c47 into master Oct 10, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants