From fec9664699353435df2a99ac3168066c715d3421 Mon Sep 17 00:00:00 2001 From: Sharat Sharma Date: Fri, 21 Jul 2017 15:11:05 +0530 Subject: [PATCH] String interpolation should be delayed From [1], string interpolation should be delayed to be handled by the logging code, rather than being done at the point of the logging call. [1] https://docs.openstack.org/oslo.i18n/latest/user/ guidelines.html#adding-variables-to-log-messages Change-Id: I58ee3e1b4b04ce895a4922491f22094aab0d16d9 Closes-Bug: #1705634 --- mistralclient/api/httpclient.py | 4 ++-- mistralclient/auth/keycloak.py | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/mistralclient/api/httpclient.py b/mistralclient/api/httpclient.py index aeb2de8a..f355cca6 100644 --- a/mistralclient/api/httpclient.py +++ b/mistralclient/api/httpclient.py @@ -50,8 +50,8 @@ LOG = logging.getLogger(__name__) def log_request(func): def decorator(self, *args, **kwargs): resp = func(self, *args, **kwargs) - LOG.debug("HTTP %s %s %d" % (resp.request.method, resp.url, - resp.status_code)) + LOG.debug("HTTP %s %s %d", resp.request.method, resp.url, + resp.status_code) return resp return decorator diff --git a/mistralclient/auth/keycloak.py b/mistralclient/auth/keycloak.py index b502efa5..2f5bc7df 100644 --- a/mistralclient/auth/keycloak.py +++ b/mistralclient/auth/keycloak.py @@ -145,10 +145,8 @@ class KeycloakAuthHandler(auth.AuthHandler): except Exception as e: raise Exception("Failed to get access token:\n %s" % str(e)) - LOG.debug( - "HTTP response from OIDC provider: %s" % - pprint.pformat(resp.json()) - ) + LOG.debug("HTTP response from OIDC provider: %s", + pprint.pformat(resp.json())) return resp.json()['access_token']