Skip to content

Commit

Permalink
Added docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
k-macmillan committed Dec 2, 2024
1 parent 37f5a67 commit 946f37b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions notifications_utils/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,5 +160,9 @@ def filter(self, record):
return record

@classmethod
def _get_api_id(self):
return g.request_id if getattr(g, 'request_id', '') else str(uuid4()).replace('-', '')
def _get_api_id(self) -> str:
"""Generate a request_id.
g is a global for this request. It is attached to the Flask and is only persisted for that request.
"""
return g.request_id if getattr(g, 'request_id', '') else str(uuid4())

0 comments on commit 946f37b

Please sign in to comment.