Skip to content

Commit 18a9083

Browse files
authored
Fix #645: Switch log messages to INFO level (#884)
* Switch log messages to INFO level * Restore assertions about log level * Don't address reviews during meetings
1 parent b999308 commit 18a9083

File tree

5 files changed

+27
-27
lines changed

5 files changed

+27
-27
lines changed

jbi/bugzilla/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def extract_from_see_also(self, project_key):
9898
parsed_url: ParseResult = urlparse(url=url)
9999
host_parts = parsed_url.hostname.split(".")
100100
except (ValueError, AttributeError):
101-
logger.debug(
101+
logger.info(
102102
"Bug %s `see_also` is not a URL: %s",
103103
self.id,
104104
url,

jbi/jira/service.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ def fetch_visible_projects(self) -> list[str]:
5050

5151
def get_issue(self, context: ActionContext, issue_key):
5252
"""Return the Jira issue fields or `None` if not found."""
53-
logger.debug("Getting issue %s", issue_key, extra=context.model_dump())
53+
logger.info("Getting issue %s", issue_key, extra=context.model_dump())
5454
try:
5555
response = self.client.get_issue(issue_key)
56-
logger.debug(
56+
logger.info(
5757
"Received issue %s",
5858
issue_key,
5959
extra={"response": response, **context.model_dump()},
@@ -83,7 +83,7 @@ def create_jira_issue(
8383
),
8484
"project": {"key": context.jira.project},
8585
}
86-
logger.debug(
86+
logger.info(
8787
"Creating new Jira issue for Bug %s",
8888
bug.id,
8989
extra={"fields": fields, **context.model_dump()},
@@ -107,7 +107,7 @@ def create_jira_issue(
107107
# Jira response can be of the form: List or Dictionary
108108
# if a list is returned, get the first item
109109
issue_data = response[0] if isinstance(response, list) else response
110-
logger.debug(
110+
logger.info(
111111
"Jira issue %s created for Bug %s",
112112
issue_data["key"],
113113
bug.id,
@@ -130,7 +130,7 @@ def add_jira_comment(self, context: ActionContext):
130130
issue_key=issue_key,
131131
comment=formatted_comment,
132132
)
133-
logger.debug(
133+
logger.info(
134134
"User comment added to Jira issue %s",
135135
issue_key,
136136
extra=context.model_dump(),
@@ -159,7 +159,7 @@ def add_jira_comments_for_changes(self, context: ActionContext):
159159

160160
jira_response_comments = []
161161
for i, comment in enumerate(comments):
162-
logger.debug(
162+
logger.info(
163163
"Create comment #%s on Jira issue %s",
164164
i + 1,
165165
issue_key,
@@ -201,7 +201,7 @@ def add_link_to_bugzilla(self, context: ActionContext):
201201
bug = context.bug
202202
issue_key = context.jira.issue
203203
bugzilla_url = f"{settings.bugzilla_base_url}/show_bug.cgi?id={bug.id}"
204-
logger.debug(
204+
logger.info(
205205
"Link %r on Jira issue %s",
206206
bugzilla_url,
207207
issue_key,
@@ -219,12 +219,12 @@ def add_link_to_bugzilla(self, context: ActionContext):
219219
def clear_assignee(self, context: ActionContext):
220220
"""Clear the assignee of the specified Jira issue."""
221221
issue_key = context.jira.issue
222-
logger.debug("Clearing assignee", extra=context.model_dump())
222+
logger.info("Clearing assignee", extra=context.model_dump())
223223
return self.client.update_issue_field(key=issue_key, fields={"assignee": None})
224224

225225
def find_jira_user(self, context: ActionContext, email: str):
226226
"""Lookup Jira users, raise an error if not exactly one found."""
227-
logger.debug("Find Jira user with email %s", email, extra=context.model_dump())
227+
logger.info("Find Jira user with email %s", email, extra=context.model_dump())
228228
users = self.client.user_find_by_user_string(query=email)
229229
if len(users) != 1:
230230
raise ValueError(f"User {email} not found")
@@ -255,7 +255,7 @@ def update_issue_status(self, context: ActionContext, jira_status: str):
255255
issue_key = context.jira.issue
256256
assert issue_key # Until we have more fine-grained typing of contexts
257257

258-
logger.debug(
258+
logger.info(
259259
"Updating Jira status to %s",
260260
jira_status,
261261
extra=context.model_dump(),
@@ -270,7 +270,7 @@ def update_issue_summary(self, context: ActionContext):
270270

271271
bug = context.bug
272272
issue_key = context.jira.issue
273-
logger.debug(
273+
logger.info(
274274
"Update summary of Jira issue %s for Bug %s",
275275
issue_key,
276276
bug.id,
@@ -290,7 +290,7 @@ def update_issue_resolution(self, context: ActionContext, jira_resolution: str):
290290
issue_key = context.jira.issue
291291
assert issue_key # Until we have more fine-grained typing of contexts
292292

293-
logger.debug(
293+
logger.info(
294294
"Updating resolution of Jira issue %s to %s",
295295
issue_key,
296296
jira_resolution,
@@ -300,7 +300,7 @@ def update_issue_resolution(self, context: ActionContext, jira_resolution: str):
300300
key=issue_key,
301301
fields={"resolution": {"name": jira_resolution}},
302302
)
303-
logger.debug(
303+
logger.info(
304304
"Updated resolution of Jira issue %s to %s",
305305
issue_key,
306306
jira_resolution,

jbi/runner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def __call__(self, context: ActionContext) -> ActionResult:
140140
if step_responses:
141141
has_produced_request = True
142142
for response in step_responses:
143-
logger.debug(
143+
logger.info(
144144
"Received %s",
145145
response,
146146
extra={
@@ -178,7 +178,7 @@ def execute_action(
178178
if bug.is_private:
179179
raise IgnoreInvalidRequestError("private bugs are not supported")
180180

181-
logger.debug(
181+
logger.info(
182182
"Handling incoming request",
183183
extra=runner_context.model_dump(),
184184
)

jbi/steps.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def create_comment(context: ActionContext, *, jira_service: JiraService) -> Step
5151
bug = context.bug
5252

5353
if bug.comment is None:
54-
logger.debug(
54+
logger.info(
5555
"No matching comment found in payload",
5656
extra=context.model_dump(),
5757
)
@@ -92,7 +92,7 @@ def add_link_to_jira(
9292
) -> StepResult:
9393
"""Add the URL to the Jira issue in the `see_also` field on the Bugzilla ticket"""
9494
jira_url = f"{settings.jira_base_url}browse/{context.jira.issue}"
95-
logger.debug(
95+
logger.info(
9696
"Link %r on Bug %s",
9797
jira_url,
9898
context.bug.id,
@@ -178,7 +178,7 @@ def maybe_assign_jira_user(
178178
context.append_responses(resp)
179179
return (StepStatus.SUCCESS, context)
180180
except ValueError as exc:
181-
logger.debug(str(exc), extra=context.model_dump())
181+
logger.info(str(exc), extra=context.model_dump())
182182
return (StepStatus.INCOMPLETE, context)
183183

184184
if context.operation == Operation.UPDATE:
@@ -191,7 +191,7 @@ def maybe_assign_jira_user(
191191
try:
192192
resp = jira_service.assign_jira_user(context, bug.assigned_to) # type: ignore
193193
except ValueError as exc:
194-
logger.debug(str(exc), extra=context.model_dump())
194+
logger.info(str(exc), extra=context.model_dump())
195195
# If that failed then just fall back to clearing the assignee.
196196
resp = jira_service.clear_assignee(context)
197197
context.append_responses(resp)
@@ -212,7 +212,7 @@ def maybe_update_issue_resolution(
212212
jira_resolution = parameters.resolution_map.get(bz_resolution)
213213

214214
if jira_resolution is None:
215-
logger.debug(
215+
logger.info(
216216
"Bug resolution %r was not in the resolution map.",
217217
bz_resolution,
218218
extra=context.update(
@@ -246,7 +246,7 @@ def maybe_update_issue_status(
246246
jira_status = parameters.status_map.get(bz_status or "")
247247

248248
if jira_status is None:
249-
logger.debug(
249+
logger.info(
250250
"Bug status %r was not in the status map.",
251251
bz_status,
252252
extra=context.update(

tests/unit/jira/test_service.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def test_get_issue_handles_404(
162162
assert return_val is None
163163

164164
before, after = capturelogs.records
165-
assert before.levelno == logging.DEBUG
165+
assert before.levelno == logging.INFO
166166
assert before.message == "Getting issue JBI-234"
167167

168168
assert after.levelno == logging.ERROR
@@ -180,7 +180,7 @@ def test_get_issue_reraises_other_erroring_status_codes(
180180
jira_service.get_issue(context=action_context, issue_key="JBI-234")
181181

182182
[record] = capturelogs.records
183-
assert record.levelno == logging.DEBUG
183+
assert record.levelno == logging.INFO
184184
assert record.message == "Getting issue JBI-234"
185185

186186

@@ -305,11 +305,11 @@ def test_create_jira_issue_when_list_is_returned(
305305

306306
before, after = capturelogs.records
307307
assert before.message == f"Creating new Jira issue for Bug {context.bug.id}"
308-
assert before.levelno == logging.DEBUG
308+
assert before.levelno == logging.INFO
309309
assert before.fields == issue_fields
310310

311311
assert after.message == f"Jira issue JBI-234 created for Bug {context.bug.id}"
312-
assert after.levelno == logging.DEBUG
312+
assert after.levelno == logging.INFO
313313
assert after.response == [mocked_issue_data]
314314

315315

@@ -340,7 +340,7 @@ def test_create_jira_issue_returns_errors(
340340

341341
before, after = capturelogs.records
342342
assert before.message == f"Creating new Jira issue for Bug {context.bug.id}"
343-
assert before.levelno == logging.DEBUG
343+
assert before.levelno == logging.INFO
344344
assert before.fields == issue_fields
345345

346346
assert after.message == f"Failed to create issue for Bug {context.bug.id}"

0 commit comments

Comments
 (0)