From 4c01c6b959b2964b0d2736d1a3cb6dfc25bc8538 Mon Sep 17 00:00:00 2001 From: Terry Howe Date: Fri, 25 Jul 2014 17:09:10 -0600 Subject: [PATCH] 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 --- openstack/transport.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openstack/transport.py b/openstack/transport.py index 0a70484b..2ac884b7 100644 --- a/openstack/transport.py +++ b/openstack/transport.py @@ -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'])