From 34b89900c2e4863350756b440af45e340487d76c Mon Sep 17 00:00:00 2001 From: hamzawaleed01 Date: Fri, 13 Oct 2023 16:57:45 +0500 Subject: [PATCH] feat: ENT-7725 add logs to debug --- integrated_channels/degreed2/client.py | 32 +++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/integrated_channels/degreed2/client.py b/integrated_channels/degreed2/client.py index 91a2dcae8f..2eeb1ad4bc 100644 --- a/integrated_channels/degreed2/client.py +++ b/integrated_channels/degreed2/client.py @@ -114,6 +114,16 @@ def create_course_completion(self, user_id, payload): Returns: status_code, response_text """ json_payload = json.loads(payload) + LOGGER.error( + generate_formatted_log( + self.enterprise_configuration.channel_code(), + self.enterprise_configuration.enterprise_customer.uuid, + user_id, + None, + '[Degreed2Client] - Attempting degreed2 create_course_completion,' + f'payload:{json_payload}' + ) + ) LOGGER.info(self.make_log_msg( json_payload.get('data').get('attributes').get('content-id'), f'Attempting find course via url: {self.get_completions_url()}'), @@ -378,13 +388,33 @@ def _post(self, url, data, scope): self.enterprise_configuration.enterprise_customer.uuid, None, None, - f'429 detected from {url}, backing-off before retrying, ' + f'[Degreed2Client] 429 detected from {url}, backing-off before retrying, ' f'sleeping {sleep_seconds} seconds...' ) ) time.sleep(sleep_seconds) else: + LOGGER.error( + generate_formatted_log( + self.enterprise_configuration.channel_code(), + self.enterprise_configuration.enterprise_customer.uuid, + None, + None, + '[Degreed2Client] - Exceeded retry attempts:' + f'URL:{url}, DATA:{data}' + ) + ) break + LOGGER.error( + generate_formatted_log( + self.enterprise_configuration.channel_code(), + self.enterprise_configuration.enterprise_customer.uuid, + None, + None, + '[Degreed2Client] - Successfuly called:' + f'RESPONSE:{response}' + ) + ) return response.status_code, response.text def _patch(self, url, data, scope):