How to use the sap.cf_logging.record.util.parse_int 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 / unit / record / test_util.py View on Github external
def test_parse_int():
    """ test util.parse_int works correctly """
    assert util.parse_int('194', 5) == 194
    assert util.parse_int(9811, -1) == 9811
github SAP / cf-python-logging-support / tests / unit / record / test_util.py View on Github external
def test_parse_int_default():
    """ test util.parse_int will return default for invalid input"""
    assert util.parse_int('1a23', 3) == 3
    assert util.parse_int('{}', -1) == -1
github SAP / cf-python-logging-support / sap / cf_logging / record / request_log_record.py View on Github external
request) or defaults.UNKNOWN

        request_start = context.get(
            'request_started_at', request) or defaults.UNIX_EPOCH
        self.request_received_at = util.iso_time_format(request_start)

        # response related
        response_sent_at = context.get(
            'response_sent_at', request) or defaults.UNIX_EPOCH
        self.response_sent_at = util.iso_time_format(response_sent_at)
        self.response_time_ms = util.time_delta_ms(
            request_start, response_sent_at)

        self.response_status = util.parse_int(
            response_reader.get_status_code(response), defaults.STATUS)
        self.response_size_b = util.parse_int(
            response_reader.get_response_size(response), defaults.RESPONSE_SIZE_B)
        self.response_content_type = response_reader.get_content_type(response)

        self._hide_sensitive_fields()