-
Notifications
You must be signed in to change notification settings - Fork 1
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
Added different level of logs throughout whole codebase. #342
Added different level of logs throughout whole codebase. #342
Conversation
logger.info( | ||
f"Successfully updated {column_name} with value {mapped_table_column_value} for user with id {user_details.id}" | ||
) |
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.
This is not required
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.
Removed
@@ -43,6 +45,7 @@ def get_program_sequence_id(self, jsonData): | |||
|
|||
if not user_program_details: | |||
# Need to log this | |||
logger.error("No user program details found") |
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.
Can we print user_id as well
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.
Added
api/services/prompt_service.py
Outdated
logger.info( | ||
f" user_phone: {self.user_phone}, call_log_id: {self.call_log_id}, content_version_id: {self.content_version_id}" | ||
) |
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.
Not needed
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.
Removed
api/services/prompt_service.py
Outdated
logger.info( | ||
"IVR prompt response exists for prompt '{}' and response '{}'".format( | ||
prompt_name, prompt_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.
Not nededed
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.
Removed
api/helpers/db_helper.py
Outdated
return partner_system_phone.partner_id | ||
except Exception as e: | ||
logger.error( | ||
f"Error while fetching partner id by system phone {system_phone}: {e}" |
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.
f"Error while fetching partner id by system phone {system_phone}: {e}" | |
f"Error while fetching partner id by system phone {system_phone}. Error message: {e}" |
api/helpers/db_helper.py
Outdated
print("Error: " + str(e)) | ||
print(traceback.format_exc()) | ||
logger.error( | ||
f"Error occurred while commiting the data in the database. Error Message: {e}" |
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.
f"Error occurred while commiting the data in the database. Error Message: {e}" | |
f"Error occurred while committing the data in the database. Error message: {e}" |
api/helpers/prompt_helper.py
Outdated
split_prompt = data.split("-") | ||
return split_prompt | ||
except Exception as e: | ||
logger.error(f"Error while splitting prompt by hyphen: {e}") |
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.
logger.error(f"Error while splitting prompt by hyphen: {e}") | |
logger.error(f"Error while splitting prompt '{data}' by hyphen. Error message: {e}") |
api/helpers/prompt_helper.py
Outdated
program_sub_prompt = data.split("_") | ||
return program_sub_prompt | ||
except Exception as e: | ||
logger.error(f"Error while splitting prompt by underscore: {e}") |
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.
logger.error(f"Error while splitting prompt by underscore: {e}") | |
logger.error(f"Error while splitting prompt '{data}' by underscore. Error message: {e}") |
api/helpers/prompt_helper.py
Outdated
except Exception as e: | ||
logger.error(f"Error while getting program prompt id: {e}") |
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.
This try and except is not needed.
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.
Removed
main.py
Outdated
return ( | ||
jsonify(message="Currently, the system do not accept a GET request"), | ||
405, | ||
) | ||
except Exception as e: | ||
print(e) | ||
logger.error("[ERROR] An unexpected error occurred: %s" % e) |
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.
logger.error("[ERROR] An unexpected error occurred: %s" % e) | |
logger.error(f"An unexpected error occurred. Error message: {e}" ) |
main.py
Outdated
@@ -63,6 +63,7 @@ def retry_failed_webhook(transaction_log_service): | |||
|
|||
log.processed = True | |||
db_helper.save(log) | |||
logger.info("[INFO] Successfully processed the failed log") |
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.
No needed
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.
Removed
main.py
Outdated
@@ -116,9 +117,12 @@ def handle_payload(jsonData, is_retry_payload=False): | |||
if jsonData.get("flow_category") == "dry_flow" and not is_retry_payload: | |||
handle_contact_fields_and_groups(jsonData) | |||
else: | |||
logger.error("[ERROR] No 'contact' key found in the input JSON data.") |
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.
logger.error("[ERROR] No 'contact' key found in the input JSON data.") | |
logger.error("No 'contact' key found in the input JSON data. {josnData}") |
main.py
Outdated
return -1 | ||
except: | ||
except Exception as e: | ||
logger.error(f"[ERROR] Exception Occured while handeling payload: {e}") |
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.
logger.error(f"[ERROR] Exception Occured while handeling payload: {e}") | |
logger.error(f"Exception occurred while handling payload: {e}") |
main.py
Outdated
return False | ||
logger.info("[INFO] Payload processing completed successfully.") |
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.
Not needed
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.
Removed
#338
Please complete the following steps and check these boxes before filing your PR:
Types of changes
Short description of what this resolves:
Why these change required? What problem does it solve?
By adding different levels of logs to the whole code base, we can get logs to provide detailed information about what is happening in the code, making it easier to debug issues and identify the root cause of problems.
Here we are implementing the following level of logs in the system.
Checklist: