From fc86bc10adb2c8a6f76532c9bbfb48bd9efe58c6 Mon Sep 17 00:00:00 2001 From: gkowalc Date: Fri, 18 Oct 2024 12:56:50 +0200 Subject: [PATCH] refactoring log levels --- atlassian/confluence.py | 5 ++--- atlassian/jira.py | 22 +++++++++++----------- atlassian/service_desk.py | 18 +++++++++--------- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/atlassian/confluence.py b/atlassian/confluence.py index 741b16f7e..6fa570b8a 100644 --- a/atlassian/confluence.py +++ b/atlassian/confluence.py @@ -762,7 +762,6 @@ def get_all_pages_by_space_ids_confluence_cloud( @deprecated(version="2.4.2", reason="Use get_all_restrictions_for_content()") def get_all_restictions_for_content(self, content_id): """Let's use the get_all_restrictions_for_content()""" - log.warning("Please, be informed that is deprecated as typo naming") return self.get_all_restrictions_for_content(content_id=content_id) def get_all_restrictions_for_content(self, content_id): @@ -2284,7 +2283,7 @@ def remove_group(self, name): :param name: str :return: """ - log.warning("Removing group...") + log.info("Removing group: %s during Confluence remove_group method execution", name) url = "rest/api/admin/group/{groupName}".format(groupName=name) try: @@ -2714,7 +2713,7 @@ def get_atl_request(url: str): } elif export_type == "pdf": url = "spaces/flyingpdf/doflyingpdf.action?key=" + space_key - log.info("Initiate PDF space export from space " + str(space_key)) + log.info("Initiated PDF space export") return self.get_pdf_download_url_for_confluence_cloud(url) else: raise ValueError("Invalid export_type parameter value. Valid values are: 'html/csv/xml/pdf'") diff --git a/atlassian/jira.py b/atlassian/jira.py index 898db0651..e5fada238 100644 --- a/atlassian/jira.py +++ b/atlassian/jira.py @@ -599,7 +599,7 @@ def get_component_related_issues(self, component_id): return self.get(url) def create_component(self, component): - log.warning('Creating component "%s"', component["name"]) + log.info('Creating component "%s"', component["name"]) base_url = self.resource_url("component") url = "{base_url}/".format(base_url=base_url) return self.post(url, data=component) @@ -610,7 +610,7 @@ def update_component(self, component, component_id): return self.put(url, data=component) def delete_component(self, component_id): - log.warning('Deleting component "%s"', component_id) + log.info('Deleting component "%s"', component_id) base_url = self.resource_url("component") return self.delete("{base_url}/{component_id}".format(base_url=base_url, component_id=component_id)) @@ -965,7 +965,7 @@ def remove_group(self, name, swap_group=None): :param swap_group: str - swap group :return: """ - log.warning("Removing group...") + log.info("Removing group: %s ", name) url = self.resource_url("group") if swap_group is not None: params = {"groupname": name, "swapGroup": swap_group} @@ -1030,7 +1030,7 @@ def remove_user_from_group(self, username=None, group_name=None, account_id=None :param group_name: str :return: """ - log.warning("Removing user from a group...") + log.info("Removing user: %s from a group: %s", username, group_name) url = self.resource_url("group/user") url_domain = self.url if "atlassian.net" in url_domain: @@ -1422,7 +1422,7 @@ def add_attachment_object(self, issue_key, attachment): :param issue_key: str :param attachment: IO Object """ - log.warning("Adding attachment...") + log.info("Adding attachment: %s", attachment) base_url = self.resource_url("issue") url = "{base_url}/{issue_key}/attachments".format(base_url=base_url, issue_key=issue_key) if attachment: @@ -1472,13 +1472,13 @@ def delete_issue(self, issue_id_or_key, delete_subtasks=True): else: params["deleteSubtasks"] = "false" - log.warning("Removing issue %s...", issue_id_or_key) + log.info("Removing issue %s...", issue_id_or_key) return self.delete(url, params=params) # @todo merge with edit_issue method def issue_update(self, issue_key, fields): - log.warning('Updating issue "%s" with "%s"', issue_key, fields) + log.info('Updating issue "%s" with "%s"', issue_key, fields) base_url = self.resource_url("issue") url = "{base_url}/{issue_key}".format(base_url=base_url, issue_key=issue_key) return self.put(url, data={"fields": fields}) @@ -1512,7 +1512,7 @@ def issue_add_watcher(self, issue_key, user): :param user: :return: """ - log.warning('Adding user %s to "%s" watchers', user, issue_key) + log.info('Adding user %s to "%s" watchers', user, issue_key) data = user base_url = self.resource_url("issue") return self.post( @@ -1527,7 +1527,7 @@ def issue_delete_watcher(self, issue_key, user): :param user: :return: """ - log.warning('Deleting user %s from "%s" watchers', user, issue_key) + log.info('Deleting user %s from "%s" watchers', user, issue_key) params = {"username": user} base_url = self.resource_url("issue") return self.delete( @@ -1613,7 +1613,7 @@ def create_issues(self, list_of_issues_data): # @todo refactor and merge with create_issue method def issue_create(self, fields): - log.warning('Creating issue "%s"', fields["summary"]) + log.info('Creating issue "%s"', fields["summary"]) url = self.resource_url("issue") return self.post(url, data={"fields": fields}) @@ -2141,7 +2141,7 @@ def user_create(self, username, email, display_name, password=None, notification Default:false. :return: """ - log.warning("Creating user %s", display_name) + log.info("Creating user %s", display_name) data = { "name": username, "emailAddress": email, diff --git a/atlassian/service_desk.py b/atlassian/service_desk.py index ff59ea237..ed1ae757b 100644 --- a/atlassian/service_desk.py +++ b/atlassian/service_desk.py @@ -56,7 +56,7 @@ def create_customer(self, full_name, email): :param email: str - email address :return: New customer """ - log.warning("Creating customer...") + log.info("Creating customer using create_customer method...") data = {"fullName": full_name, "email": email} return self.post( @@ -236,7 +236,7 @@ def perform_transition(self, issue_id_or_key, transition_id, comment=None): :param comment: OPTIONAL: str :return: None """ - log.warning("Performing transition...") + log.info("Performing transition for issue: " + issue_id_or_key) data = {"id": transition_id, "additionalComment": {"body": comment}} url = "rest/servicedeskapi/request/{}/transition".format(issue_id_or_key) @@ -373,7 +373,7 @@ def create_organization(self, name): :param name: str :return: Organization data """ - log.warning("Creating organization...") + log.info("Creating organization: " + name) url = "rest/servicedeskapi/organization" data = {"name": name} @@ -387,7 +387,7 @@ def add_organization(self, service_desk_id, organization_id): :param organization_id: int :return: """ - log.warning("Adding organization...") + log.info("Adding organization...") url = "rest/servicedeskapi/servicedesk/{}/organization".format(service_desk_id) data = {"organizationId": organization_id} @@ -401,7 +401,7 @@ def remove_organization(self, service_desk_id, organization_id): :param organization_id: int :return: """ - log.warning("Removing organization...") + log.info("Removing organization...") url = "rest/servicedeskapi/servicedesk/{}/organization".format(service_desk_id) data = {"organizationId": organization_id} @@ -414,7 +414,7 @@ def delete_organization(self, organization_id): :param organization_id: :return: """ - log.warning("Deleting organization...") + log.info("Deleting organization: %s ", organization_id) url = "rest/servicedeskapi/organization/{}".format(organization_id) return self.delete(url, headers=self.experimental_headers) @@ -430,7 +430,7 @@ def add_users_to_organization(self, organization_id, users_list=[], account_list :param users_list: list :return: """ - log.warning("Adding users...") + log.info("Adding users: %s ", str(users_list)) url = "rest/servicedeskapi/organization/{}/user".format(organization_id) data = {"usernames": users_list, "accountIds": account_list} @@ -447,7 +447,7 @@ def remove_users_from_organization(self, organization_id, users_list=[], account :param account_list: list :return: """ - log.warning("Removing users...") + log.info("Removing users: %s", str(users_list)) url = "rest/servicedeskapi/organization/{}/user".format(organization_id) data = {"usernames": users_list, "accountIds": account_list} @@ -901,7 +901,7 @@ def create_request_type( :param request_name: str :param request_description: str """ - log.warning("Creating request type...") + log.info("Creating request type") data = { "issueTypeId": request_type_id, "name": request_name,