Browse Source

Handle log message interpolation by the logger

According to OpenStack Guideline[1], logged string message should be
interpolated by the logger.

[1]: http://docs.openstack.org/developer/oslo.i18n/guidelines.html#adding-variables-to-log-messages

Change-Id: Ib5f86d1f0846e292457813c893b73c6999e554a5
Closes-Bug: #1596829
tags/2.0.0
Gábor Antal 2 years ago
parent
commit
84346b5dba

+ 2
- 2
cinderclient/apiclient/client.py View File

@@ -125,9 +125,9 @@ class HTTPClient(object):
125 125
                       self._safe_header(element, kwargs['headers'][element]))
126 126
             string_parts.append(header)
127 127
 
128
-        _logger.debug("REQ: %s" % " ".join(string_parts))
128
+        _logger.debug("REQ: %s", " ".join(string_parts))
129 129
         if 'data' in kwargs:
130
-            _logger.debug("REQ BODY: %s\n" % (kwargs['data']))
130
+            _logger.debug("REQ BODY: %s\n", (kwargs['data']))
131 131
 
132 132
     def _http_log_resp(self, resp):
133 133
         if not self.debug:

+ 1
- 1
cinderclient/auth_plugin.py View File

@@ -37,7 +37,7 @@ def discover_auth_systems():
37 37
         try:
38 38
             auth_plugin = ep.load()
39 39
         except (ImportError, pkg_resources.UnknownExtra, AttributeError) as e:
40
-            logger.debug("ERROR: Cannot load auth plugin %s" % ep.name)
40
+            logger.debug("ERROR: Cannot load auth plugin %s", ep.name)
41 41
             logger.debug(e, exc_info=1)
42 42
         else:
43 43
             _discovered_plugins[ep.name] = auth_plugin

+ 1
- 1
cinderclient/client.py View File

@@ -93,7 +93,7 @@ def get_server_version(url):
93 93
                         api_versions.APIVersion(version['version']))
94 94
     except exceptions.ClientException as e:
95 95
         logger.warning(_LW("Error in server version query:%s\n"
96
-                 "Returning APIVersion 2.0") % six.text_type(e.message))
96
+                 "Returning APIVersion 2.0"), six.text_type(e.message))
97 97
         return api_versions.APIVersion("2.0"), api_versions.APIVersion("2.0")
98 98
 
99 99
 

+ 2
- 2
cinderclient/shell.py View File

@@ -757,12 +757,12 @@ class OpenStackCinderShell(object):
757 757
             if api_version_input:
758 758
                 logger.warning("Cannot determine the API version from "
759 759
                                "the endpoint URL. Falling back to the "
760
-                               "user-specified version: %s" %
760
+                               "user-specified version: %s",
761 761
                                endpoint_api_version)
762 762
             else:
763 763
                 logger.warning("Cannot determine the API version from the "
764 764
                                "endpoint URL or user input. Falling back "
765
-                               "to the default API version: %s" %
765
+                               "to the default API version: %s",
766 766
                                endpoint_api_version)
767 767
 
768 768
         profile = osprofiler_profiler and options.profile

Loading…
Cancel
Save