From 94c317250e280dfd5e00a99958ff18780d7cec4d Mon Sep 17 00:00:00 2001 From: daohanli Date: Tue, 21 Mar 2017 23:22:53 +0800 Subject: [PATCH] Remove log translations Log messages are no longer being translated. This removes all use of the _LE, _LI, and _LW translation markers to simplify logging and to avoid confusion with new contributions. See: http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html Change-Id: Icfe6ab464fd9fbbbfb9c9a05dba2220aa9e0bace --- watcherclient/_i18n.py | 10 ---------- watcherclient/common/api_versioning.py | 6 +++--- watcherclient/common/httpclient.py | 18 +++++++++--------- 3 files changed, 12 insertions(+), 22 deletions(-) diff --git a/watcherclient/_i18n.py b/watcherclient/_i18n.py index cafe853..4f370d3 100644 --- a/watcherclient/_i18n.py +++ b/watcherclient/_i18n.py @@ -30,16 +30,6 @@ _C = _translators.contextual_form # requires oslo.i18n >=2.1.0 _P = _translators.plural_form -# Translators for log levels. -# -# The abbreviated names are meant to reflect the usual use of a short -# name like '_'. The "L" is for "log" and the other letter comes from -# the level. -_LI = _translators.log_info -_LW = _translators.log_warning -_LE = _translators.log_error -_LC = _translators.log_critical - def get_available_languages(): return oslo_i18n.get_available_languages(DOMAIN) diff --git a/watcherclient/common/api_versioning.py b/watcherclient/common/api_versioning.py index 50959d9..40c546c 100644 --- a/watcherclient/common/api_versioning.py +++ b/watcherclient/common/api_versioning.py @@ -18,7 +18,7 @@ import re from oslo_utils import strutils -from watcherclient._i18n import _, _LW +from watcherclient._i18n import _ from watcherclient import exceptions LOG = logging.getLogger(__name__) @@ -202,8 +202,8 @@ def get_api_version(version_string): version_string = str(version_string) if version_string in DEPRECATED_VERSIONS: LOG.warning( - _LW("Version %(deprecated_version)s is deprecated, using " - "alternative version %(alternative)s instead."), + "Version %(deprecated_version)s is deprecated, using " + "alternative version %(alternative)s instead.", {"deprecated_version": version_string, "alternative": DEPRECATED_VERSIONS[version_string]}) version_string = DEPRECATED_VERSIONS[version_string] diff --git a/watcherclient/common/httpclient.py b/watcherclient/common/httpclient.py index c5e5577..04e9908 100644 --- a/watcherclient/common/httpclient.py +++ b/watcherclient/common/httpclient.py @@ -33,7 +33,7 @@ import six from six.moves import http_client import six.moves.urllib.parse as urlparse -from watcherclient._i18n import _, _LE, _LW +from watcherclient._i18n import _ from watcherclient import exceptions @@ -185,8 +185,8 @@ def with_retries(func): try: return func(self, url, method, **kwargs) except _RETRY_EXCEPTIONS as error: - msg = (_LE("Error contacting Watcher server: %(error)s. " - "Attempt %(attempt)d of %(total)d") % + msg = ("Error contacting Watcher server: %(error)s. " + "Attempt %(attempt)d of %(total)d" % {'attempt': attempt, 'total': num_attempts, 'error': error}) @@ -397,7 +397,7 @@ class HTTPClient(VersionNegotiationMixin): try: body = jsonutils.loads(body) except ValueError: - LOG.error(_LE('Could not decode response body as JSON')) + LOG.error('Could not decode response body as JSON') else: body = None @@ -558,7 +558,7 @@ class SessionClient(VersionNegotiationMixin, adapter.LegacyJsonAdapter): try: body = resp.json() except ValueError: - LOG.error(_LE('Could not decode response body as JSON')) + LOG.error('Could not decode response body as JSON') else: body = None @@ -602,8 +602,8 @@ def _construct_http_client(endpoint=None, dvars = [k for k, v in ignored.items() if v] if dvars: - LOG.warning(_LW('The following arguments are ignored when using ' - 'the session to construct a client: %s'), + LOG.warning('The following arguments are ignored when using ' + 'the session to construct a client: %s', ', '.join(dvars)) return SessionClient(session=session, @@ -615,8 +615,8 @@ def _construct_http_client(endpoint=None, **kwargs) else: if kwargs: - LOG.warning(_LW('The following arguments are being ignored when ' - 'constructing the client: %s'), ', '.join(kwargs)) + LOG.warning('The following arguments are being ignored when ' + 'constructing the client: %s', ', '.join(kwargs)) return HTTPClient(endpoint=endpoint, token=token,