How to use the sap.cf_logging.FRAMEWORK 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 / tests / test_job_logging.py View on Github external
def test_set_correlation_id():
    """ Test setting correlation_id """
    correlation_id = '1234'
    cf_logging.init(level=logging.DEBUG)
    cf_logging.FRAMEWORK.context.set_correlation_id(correlation_id)

    logger, stream = config_logger('cli.test')
    logger.info('hi')

    log_json = JSONDecoder().decode(stream.getvalue())
    _, error = JsonValidator(JOB_LOG_SCHEMA).validate(log_json)

    assert error == {}
    assert log_json['correlation_id'] == correlation_id
    assert cf_logging.FRAMEWORK.context.get_correlation_id() == correlation_id
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 / falcon_logging / __init__.py View on Github external
def process_request(self, request, response): # pylint: disable=unused-argument,no-self-use
        """Process the request before routing it.

        :param request: - Falcon Request object
        :param response: - Falcon Response object
        """
        framework = cf_logging.FRAMEWORK
        cid = framework.request_reader.get_correlation_id(request)
        framework.context.set_correlation_id(cid, request)
        framework.context.set('request_started_at', datetime.utcnow(), request)
github SAP / cf-python-logging-support / sap / cf_logging / flask_logging / __init__.py View on Github external
def _wrapper():
        framework = cf_logging.FRAMEWORK
        cid = framework.request_reader.get_correlation_id(request)
        framework.context.set_correlation_id(cid, request)
        framework.context.set('request_started_at', datetime.utcnow(), request)
        return wrapped()
    return _wrapper