Make logging more efficient in transport

Currently, transport does all the string format work on the request
and then it tries to log it without checking first if it is even
going to print.  This is low enough level code that it should be
more efficient.

Change-Id: I12ec7fe7488252c3b02c246179cdd7c1cf136716
This commit is contained in:
Terry Howe
2014-07-25 17:09:10 -06:00
parent 72e2c2253c
commit 4c01c6b959

View File

@@ -203,6 +203,9 @@ class Transport(requests.Session):
return resp
def _log_request(self, method, url, **kwargs):
if not _logger.isEnabledFor(logging.DEBUG):
return
if 'params' in kwargs and kwargs['params']:
url += '?' + urllib.parse.urlencode(kwargs['params'])