Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _wrapper(request):
correlation_id = cf_logging.FRAMEWORK.request_reader.get_correlation_id(request)
cf_logging.FRAMEWORK.context.set_correlation_id(correlation_id, request)
cf_logging.FRAMEWORK.context.set('request_started_at', datetime.utcnow(), request)
return wrapped(request)
def _wrapper(response):
cf_logging.FRAMEWORK.context.set(
'response_sent_at', datetime.utcnow(), request)
extra = {REQUEST_KEY: request, RESPONSE_KEY: response}
logging.getLogger('cf.flask.logger').info('', extra=extra)
return wrapped(response)
return _wrapper
def process_response(self, request, response, resource, req_succeeded): # pylint: disable=unused-argument
"""Post-processing of the response (after routing).
:param request: - Falcon Request object
:param response: - Falcon Response object
:param resource: - Falcon Resource object to which the request was routed
:param req_succeeded: - True if no exceptions were raised while
the framework processed and routed the request
"""
cf_logging.FRAMEWORK.context.set(
'response_sent_at', datetime.utcnow(), request)
extra = {REQUEST_KEY: request, RESPONSE_KEY: response}
logging.getLogger(self._logger_name).info('', extra=extra)
def _wrapper(request, response):
cf_logging.FRAMEWORK.context.set('response_sent_at', datetime.utcnow(), request)
extra = {REQUEST_KEY: request, RESPONSE_KEY: response}
logging.getLogger('cf.sanic.logger').info('', extra=extra)
return wrapped(request, response)