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
This commit is contained in:
Gábor Antal 2017-02-07 16:21:21 +01:00
parent d10b467af4
commit 84346b5dba
4 changed files with 6 additions and 6 deletions

View File

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

View File

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

View File

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

View File

@ -757,12 +757,12 @@ class OpenStackCinderShell(object):
if api_version_input:
logger.warning("Cannot determine the API version from "
"the endpoint URL. Falling back to the "
"user-specified version: %s" %
"user-specified version: %s",
endpoint_api_version)
else:
logger.warning("Cannot determine the API version from the "
"endpoint URL or user input. Falling back "
"to the default API version: %s" %
"to the default API version: %s",
endpoint_api_version)
profile = osprofiler_profiler and options.profile