Skip to content

Commit

Permalink
refactoring log levels
Browse files Browse the repository at this point in the history
  • Loading branch information
gkowalc committed Oct 18, 2024
1 parent 0db9b30 commit fc86bc1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 23 deletions.
5 changes: 2 additions & 3 deletions atlassian/confluence.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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'")
Expand Down
22 changes: 11 additions & 11 deletions atlassian/jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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))

Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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})
Expand Down Expand Up @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -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})

Expand Down Expand Up @@ -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,
Expand Down
18 changes: 9 additions & 9 deletions atlassian/service_desk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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}

Expand All @@ -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}

Expand All @@ -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}

Expand All @@ -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)
Expand All @@ -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}

Expand All @@ -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}

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit fc86bc1

Please sign in to comment.