def log_response_and_raise()

in azure/datalake/store/lib.py [0:0]


    def log_response_and_raise(self, response, exception, level=logging.ERROR):
        msg = u"Exception " + repr(exception)
        if response is not None:
            msg += u"\n{}\n{}".format(
                response.status_code,
                u"\n".join([
                    u"{}: {}".format(header, response.headers[header])
                    for header in response.headers]))
            msg += u"\n\n{}".format(response.content[:MAX_CONTENT_LENGTH])
            if self._content_truncated(response):
                msg += u"\n(Response body was truncated)"
        logger.log(level, msg)
        raise exception