Skip to content

Commit

Permalink
Adding structured data (#5034)
Browse files Browse the repository at this point in the history
* Adding structured data

Recommended update to structured data being added to the logging instead of including it in the message directly

* comma fix
  • Loading branch information
jschroth authored and metroid-samus committed Sep 25, 2024
1 parent fde5072 commit 5d40927
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/dispatch/case/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,10 @@ def case_status_transition_flow_dispatcher(
db_session: Session,
):
"""Runs the correct flows based on the current and previous status of the case."""
log.info(f"Transitioning Status for Case #{case.id} from {previous_status} to {current_status}")
log.info(
"Transitioning Case status",
extra={"case_id": case.id, "previous_status": previous_status, "current_status": current_status}
)
match (previous_status, current_status):
case (CaseStatus.closed, CaseStatus.new):
# Closed -> New
Expand All @@ -569,7 +572,10 @@ def case_status_transition_flow_dispatcher(

case (_, CaseStatus.triage):
# Any -> Triage/
log.warning(f"Unexpected Status Transition for Case #{case.id} from {previous_status} to {current_status}")
log.warning(
"Unexpected previous state for Case transition to Triage state.",
extra={"case_id": case.id, "previous_status": previous_status, "current_status": current_status}
)

case (CaseStatus.new, CaseStatus.escalated):
# New -> Escalated
Expand Down

0 comments on commit 5d40927

Please sign in to comment.