How to use the sap.cf_logging.FRAMEWORK.context.set function in sap

To help you get started, we’ve selected a few sap examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SAP / cf-python-logging-support / sap / cf_logging / sanic_logging / __init__.py View on Github external
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)
github SAP / cf-python-logging-support / sap / cf_logging / flask_logging / __init__.py View on Github external
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
github SAP / cf-python-logging-support / sap / cf_logging / falcon_logging / __init__.py View on Github external
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)
github SAP / cf-python-logging-support / sap / cf_logging / sanic_logging / __init__.py View on Github external
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)