INNER CODE UNIT · Python
set_correlation_id
bobbui/json-logging-python · json_logging/framework/connexion/__init__.py:171
def set_correlation_id(self, request_, value):
if _is_async_request(request_):
# request.state lives in the ASGI scope, so every Request built for this scope sees it
request_.state.correlation_id = value
return
try:
_connexion.g.correlation_id = value
except:
pass
def get_correlation_id_in_request_context(self, request):
if _is_async_request(request):
return getattr(request.state, 'correlation_id', None)
try:
return _connexion.g.get('correlation_id', None)
except:
return None