Skip to content

Commit bdf2ffc

Browse files
authored
refactored logging levels in jira.py, service_desk.py, confluence.py, insights.py (#1468)
* refactoring log levels * refactoring log.warn logging levels --------- Co-authored-by: gkowalc <> Co-authored-by: Greg <gkowalc>
1 parent 470ee16 commit bdf2ffc

File tree

4 files changed

+24
-26
lines changed

4 files changed

+24
-26
lines changed

atlassian/confluence.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,6 @@ def get_all_pages_by_space_ids_confluence_cloud(
762762
@deprecated(version="2.4.2", reason="Use get_all_restrictions_for_content()")
763763
def get_all_restictions_for_content(self, content_id):
764764
"""Let's use the get_all_restrictions_for_content()"""
765-
log.warning("Please, be informed that is deprecated as typo naming")
766765
return self.get_all_restrictions_for_content(content_id=content_id)
767766

768767
def get_all_restrictions_for_content(self, content_id):
@@ -2284,7 +2283,7 @@ def remove_group(self, name):
22842283
:param name: str
22852284
:return:
22862285
"""
2287-
log.warning("Removing group...")
2286+
log.info("Removing group: %s during Confluence remove_group method execution", name)
22882287
url = "rest/api/admin/group/{groupName}".format(groupName=name)
22892288

22902289
try:
@@ -2714,7 +2713,7 @@ def get_atl_request(url: str):
27142713
}
27152714
elif export_type == "pdf":
27162715
url = "spaces/flyingpdf/doflyingpdf.action?key=" + space_key
2717-
log.info("Initiate PDF space export from space " + str(space_key))
2716+
log.info("Initiated PDF space export")
27182717
return self.get_pdf_download_url_for_confluence_cloud(url)
27192718
else:
27202719
raise ValueError("Invalid export_type parameter value. Valid values are: 'html/csv/xml/pdf'")

atlassian/insight.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def upload_attachment_to_object(self, object_id, filename):
118118
"""
119119
if self.cloud:
120120
raise NotImplementedError
121-
log.warning("Adding attachment...")
121+
log.info("Adding attachment...")
122122
url = "rest/insight/1.0/attachments/object/{objectId}".format(objectId=object_id)
123123
with open(filename, "rb") as attachment:
124124
files = {"file": attachment}
@@ -131,7 +131,7 @@ def delete_attachment(self, attachment_id):
131131
"""
132132
if self.cloud:
133133
raise NotImplementedError
134-
log.warning("Adding attachment...")
134+
log.info("Deleting attachment...")
135135
url = "rest/insight/1.0/attachments/{attachmentId}".format(attachmentId=attachment_id)
136136
return self.delete(url)
137137

@@ -373,7 +373,6 @@ def get_object_history(self, object_id, asc=False, abbreviate=True):
373373
@deprecated(version="3.29.0", reason="Use get_object_reference_info()")
374374
def get_object_referenceinfo(self, object_id):
375375
"""Let's use the get_object_reference_info()"""
376-
log.warning("Please, be informed that is deprecated as typo naming")
377376
self.get_object_reference_info(object_id)
378377

379378
def get_object_reference_info(self, object_id):

atlassian/jira.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ def get_component_related_issues(self, component_id):
599599
return self.get(url)
600600

601601
def create_component(self, component):
602-
log.warning('Creating component "%s"', component["name"])
602+
log.info('Creating component "%s"', component["name"])
603603
base_url = self.resource_url("component")
604604
url = "{base_url}/".format(base_url=base_url)
605605
return self.post(url, data=component)
@@ -610,7 +610,7 @@ def update_component(self, component, component_id):
610610
return self.put(url, data=component)
611611

612612
def delete_component(self, component_id):
613-
log.warning('Deleting component "%s"', component_id)
613+
log.info('Deleting component "%s"', component_id)
614614
base_url = self.resource_url("component")
615615
return self.delete("{base_url}/{component_id}".format(base_url=base_url, component_id=component_id))
616616

@@ -965,7 +965,7 @@ def remove_group(self, name, swap_group=None):
965965
:param swap_group: str - swap group
966966
:return:
967967
"""
968-
log.warning("Removing group...")
968+
log.info("Removing group: %s ", name)
969969
url = self.resource_url("group")
970970
if swap_group is not None:
971971
params = {"groupname": name, "swapGroup": swap_group}
@@ -1030,7 +1030,7 @@ def remove_user_from_group(self, username=None, group_name=None, account_id=None
10301030
:param group_name: str
10311031
:return:
10321032
"""
1033-
log.warning("Removing user from a group...")
1033+
log.info("Removing user: %s from a group: %s", username, group_name)
10341034
url = self.resource_url("group/user")
10351035
url_domain = self.url
10361036
if "atlassian.net" in url_domain:
@@ -1422,7 +1422,7 @@ def add_attachment_object(self, issue_key, attachment):
14221422
:param issue_key: str
14231423
:param attachment: IO Object
14241424
"""
1425-
log.warning("Adding attachment...")
1425+
log.info("Adding attachment: %s", attachment)
14261426
base_url = self.resource_url("issue")
14271427
url = "{base_url}/{issue_key}/attachments".format(base_url=base_url, issue_key=issue_key)
14281428
if attachment:
@@ -1472,13 +1472,13 @@ def delete_issue(self, issue_id_or_key, delete_subtasks=True):
14721472
else:
14731473
params["deleteSubtasks"] = "false"
14741474

1475-
log.warning("Removing issue %s...", issue_id_or_key)
1475+
log.info("Removing issue %s...", issue_id_or_key)
14761476

14771477
return self.delete(url, params=params)
14781478

14791479
# @todo merge with edit_issue method
14801480
def issue_update(self, issue_key, fields):
1481-
log.warning('Updating issue "%s" with "%s"', issue_key, fields)
1481+
log.info('Updating issue "%s" with "%s"', issue_key, fields)
14821482
base_url = self.resource_url("issue")
14831483
url = "{base_url}/{issue_key}".format(base_url=base_url, issue_key=issue_key)
14841484
return self.put(url, data={"fields": fields})
@@ -1512,7 +1512,7 @@ def issue_add_watcher(self, issue_key, user):
15121512
:param user:
15131513
:return:
15141514
"""
1515-
log.warning('Adding user %s to "%s" watchers', user, issue_key)
1515+
log.info('Adding user %s to "%s" watchers', user, issue_key)
15161516
data = user
15171517
base_url = self.resource_url("issue")
15181518
return self.post(
@@ -1527,7 +1527,7 @@ def issue_delete_watcher(self, issue_key, user):
15271527
:param user:
15281528
:return:
15291529
"""
1530-
log.warning('Deleting user %s from "%s" watchers', user, issue_key)
1530+
log.info('Deleting user %s from "%s" watchers', user, issue_key)
15311531
params = {"username": user}
15321532
base_url = self.resource_url("issue")
15331533
return self.delete(
@@ -1613,7 +1613,7 @@ def create_issues(self, list_of_issues_data):
16131613

16141614
# @todo refactor and merge with create_issue method
16151615
def issue_create(self, fields):
1616-
log.warning('Creating issue "%s"', fields["summary"])
1616+
log.info('Creating issue "%s"', fields["summary"])
16171617
url = self.resource_url("issue")
16181618
return self.post(url, data={"fields": fields})
16191619

@@ -2141,7 +2141,7 @@ def user_create(self, username, email, display_name, password=None, notification
21412141
Default:false.
21422142
:return:
21432143
"""
2144-
log.warning("Creating user %s", display_name)
2144+
log.info("Creating user %s", display_name)
21452145
data = {
21462146
"name": username,
21472147
"emailAddress": email,

atlassian/service_desk.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def create_customer(self, full_name, email):
5656
:param email: str - email address
5757
:return: New customer
5858
"""
59-
log.warning("Creating customer...")
59+
log.info("Creating customer using create_customer method...")
6060
data = {"fullName": full_name, "email": email}
6161

6262
return self.post(
@@ -236,7 +236,7 @@ def perform_transition(self, issue_id_or_key, transition_id, comment=None):
236236
:param comment: OPTIONAL: str
237237
:return: None
238238
"""
239-
log.warning("Performing transition...")
239+
log.info("Performing transition for issue: " + issue_id_or_key)
240240
data = {"id": transition_id, "additionalComment": {"body": comment}}
241241
url = "rest/servicedeskapi/request/{}/transition".format(issue_id_or_key)
242242

@@ -373,7 +373,7 @@ def create_organization(self, name):
373373
:param name: str
374374
:return: Organization data
375375
"""
376-
log.warning("Creating organization...")
376+
log.info("Creating organization: " + name)
377377
url = "rest/servicedeskapi/organization"
378378
data = {"name": name}
379379

@@ -387,7 +387,7 @@ def add_organization(self, service_desk_id, organization_id):
387387
:param organization_id: int
388388
:return:
389389
"""
390-
log.warning("Adding organization...")
390+
log.info("Adding organization...")
391391
url = "rest/servicedeskapi/servicedesk/{}/organization".format(service_desk_id)
392392
data = {"organizationId": organization_id}
393393

@@ -401,7 +401,7 @@ def remove_organization(self, service_desk_id, organization_id):
401401
:param organization_id: int
402402
:return:
403403
"""
404-
log.warning("Removing organization...")
404+
log.info("Removing organization...")
405405
url = "rest/servicedeskapi/servicedesk/{}/organization".format(service_desk_id)
406406
data = {"organizationId": organization_id}
407407

@@ -414,7 +414,7 @@ def delete_organization(self, organization_id):
414414
:param organization_id:
415415
:return:
416416
"""
417-
log.warning("Deleting organization...")
417+
log.info("Deleting organization: %s ", organization_id)
418418
url = "rest/servicedeskapi/organization/{}".format(organization_id)
419419

420420
return self.delete(url, headers=self.experimental_headers)
@@ -430,7 +430,7 @@ def add_users_to_organization(self, organization_id, users_list=[], account_list
430430
:param users_list: list
431431
:return:
432432
"""
433-
log.warning("Adding users...")
433+
log.info("Adding users: %s ", str(users_list))
434434
url = "rest/servicedeskapi/organization/{}/user".format(organization_id)
435435
data = {"usernames": users_list, "accountIds": account_list}
436436

@@ -447,7 +447,7 @@ def remove_users_from_organization(self, organization_id, users_list=[], account
447447
:param account_list: list
448448
:return:
449449
"""
450-
log.warning("Removing users...")
450+
log.info("Removing users: %s", str(users_list))
451451
url = "rest/servicedeskapi/organization/{}/user".format(organization_id)
452452
data = {"usernames": users_list, "accountIds": account_list}
453453

@@ -901,7 +901,7 @@ def create_request_type(
901901
:param request_name: str
902902
:param request_description: str
903903
"""
904-
log.warning("Creating request type...")
904+
log.info("Creating request type")
905905
data = {
906906
"issueTypeId": request_type_id,
907907
"name": request_name,

0 commit comments

Comments
 (0)