kitir/kits/restful_api.py
def _log_transaction(cls, response, **kwargs):
        """
        logs the request transaction, both request and response with optional kwargs
        :param response:
        :param kwargs:
        :return:
        """
        only_not_ok = kwargs.pop('only_not_ok', False)
        transact_name = kwargs.pop('transact_name', None)
        transact_parts = [transact_name, response.request.method]
        transact_id = kwargs.pop('transact_id', None) or cls._make_transaction_id(*transact_parts)
        if only_not_ok and response.ok:
            log.debug('not logging transaction (only not ok): id={} code={}'.format(transact_id, response.status_code))
            return
        save_request = kwargs.pop('save_request', True)
        save_response = kwargs.pop('save_response', True)
        dir_request = kwargs.pop('dir_request', cls._cls_request_dir)
        dir_response = kwargs.pop('dir_response', cls._cls_response_dir)
        full_request = kwargs.pop('full_request', False)
        full_response = kwargs.pop('full_response', False)
        if save_request:
            try:
                if full_request:
                    request_file_path = cls._get_log_request_file_path(dir_request, transact_id, ext='json')
                    cls._log_request_full(response, request_file_path)
                else:
                    request_file_path = cls._get_log_request_file_path(dir_request, transact_id)
                    cls._log_request(response, request_file_path)
            except Exception as exc:
                log.error('Exception logging rest transaction request: id={} exc={} trace...'.format(transact_id, exc),
                          exc_info=True)
        if save_response:
            try:
                if full_response:
                    response_file_path = cls._get_log_response_file_path(dir_response, transact_id, ext='json')
                    cls._log_response_full(response, response_file_path)
                else:
                    response_file_path = cls._get_log_response_file_path(dir_response, transact_id)
                    cls._log_response(response, response_file_path)
            except Exception as exc:
                log.error('Exception logging rest transaction response: id={} exc={} trace...'.format(transact_id, exc),
                          exc_info=True)

        logs the request transaction, both request and response with optional kwargs
        :param response:
        :param kwargs:
        :return:
        
logs the request transaction, both request and response with optional kwargs
logs the request transaction both request and response with optional kwargs
def _log_transaction(cls, response, **kwargs):
        only_not_ok = kwargs.pop('only_not_ok', False)
        transact_name = kwargs.pop('transact_name', None)
        transact_parts = [transact_name, response.request.method]
        transact_id = kwargs.pop('transact_id', None) or cls._make_transaction_id(*transact_parts)
        if only_not_ok and response.ok:
            log.debug('not logging transaction (only not ok): id={} code={}'.format(transact_id, response.status_code))
            return
        save_request = kwargs.pop('save_request', True)
        save_response = kwargs.pop('save_response', True)
        dir_request = kwargs.pop('dir_request', cls._cls_request_dir)
        dir_response = kwargs.pop('dir_response', cls._cls_response_dir)
        full_request = kwargs.pop('full_request', False)
        full_response = kwargs.pop('full_response', False)
        if save_request:
            try:
                if full_request:
                    request_file_path = cls._get_log_request_file_path(dir_request, transact_id, ext='json')
                    cls._log_request_full(response, request_file_path)
                else:
                    request_file_path = cls._get_log_request_file_path(dir_request, transact_id)
                    cls._log_request(response, request_file_path)
            except Exception as exc:
                log.error('Exception logging rest transaction request: id={} exc={} trace...'.format(transact_id, exc),
                          exc_info=True)
        if save_response:
            try:
                if full_response:
                    response_file_path = cls._get_log_response_file_path(dir_response, transact_id, ext='json')
                    cls._log_response_full(response, response_file_path)
                else:
                    response_file_path = cls._get_log_response_file_path(dir_response, transact_id)
                    cls._log_response(response, response_file_path)
            except Exception as exc:
                log.error('Exception logging rest transaction response: id={} exc={} trace...'.format(transact_id, exc),
                          exc_info=True)
def _log_transaction ( cls , response , ** kwargs ) : only_not_ok = kwargs . pop ( 'only_not_ok' , False ) transact_name = kwargs . pop ( 'transact_name' , None ) transact_parts = [ transact_name , response . request . method ] transact_id = kwargs . pop ( 'transact_id' , None ) or cls . _make_transaction_id ( * transact_parts ) if only_not_ok and response . ok : log . debug ( 'not logging transaction (only not ok): id={} code={}' . format ( transact_id , response . status_code ) ) return save_request = kwargs . pop ( 'save_request' , True ) save_response = kwargs . pop ( 'save_response' , True ) dir_request = kwargs . pop ( 'dir_request' , cls . _cls_request_dir ) dir_response = kwargs . pop ( 'dir_response' , cls . _cls_response_dir ) full_request = kwargs . pop ( 'full_request' , False ) full_response = kwargs . pop ( 'full_response' , False ) if save_request : try : if full_request : request_file_path = cls . _get_log_request_file_path ( dir_request , transact_id , ext = 'json' ) cls . _log_request_full ( response , request_file_path ) else : request_file_path = cls . _get_log_request_file_path ( dir_request , transact_id ) cls . _log_request ( response , request_file_path ) except Exception as exc : log . error ( 'Exception logging rest transaction request: id={} exc={} trace...' . format ( transact_id , exc ) , exc_info = True ) if save_response : try : if full_response : response_file_path = cls . _get_log_response_file_path ( dir_response , transact_id , ext = 'json' ) cls . _log_response_full ( response , response_file_path ) else : response_file_path = cls . _get_log_response_file_path ( dir_response , transact_id ) cls . _log_response ( response , response_file_path ) except Exception as exc : log . error ( 'Exception logging rest transaction response: id={} exc={} trace...' . format ( transact_id , exc ) , exc_info = True )
logs the request transaction, both request and response with optional kwargs
logs the request transaction both request and response with optional kwargs
"""
        logs the request transaction, both request and response with optional kwargs
        :param response:
        :param kwargs:
        :return:
        """
None
cls
response
None
kwargs
None