From 3c9286973550f5e20fd6bfdfafbe11bfe8df4d49 Mon Sep 17 00:00:00 2001 From: gaozx Date: Tue, 21 Mar 2017 02:59:26 -0400 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: I21f94b34e511ca9fd43332219d15d6d57fcf5ecf --- karborclient/common/http.py | 14 ++++++-------- karborclient/i18n.py | 10 ---------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/karborclient/common/http.py b/karborclient/common/http.py index a4cefa2..921f3b0 100644 --- a/karborclient/common/http.py +++ b/karborclient/common/http.py @@ -27,8 +27,6 @@ import six from six.moves import urllib from karborclient.common.apiclient import exceptions as exc -from karborclient.i18n import _LE -from karborclient.i18n import _LW LOG = logging.getLogger(__name__) USER_AGENT = 'python-karborclient' @@ -50,7 +48,7 @@ def get_system_ca_file(): if os.path.exists(ca): LOG.debug("Using ca file %s", ca) return ca - LOG.warning(_LW("System ca file could not be found.")) + LOG.warning("System ca file could not be found.") class HTTPClient(object): @@ -248,7 +246,7 @@ class HTTPClient(object): if 'data' in kwargs: raise ValueError("Can't provide both 'data' and " "'body' to a request") - LOG.warning(_LW("Use of 'body' is deprecated; use 'data' instead")) + LOG.warning("Use of 'body' is deprecated; use 'data' instead") kwargs['data'] = kwargs.pop('body') if 'data' in kwargs: kwargs['data'] = jsonutils.dumps(kwargs['data']) @@ -260,7 +258,7 @@ class HTTPClient(object): 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 @@ -271,7 +269,7 @@ class HTTPClient(object): if 'data' in kwargs: raise ValueError("Can't provide both 'data' and " "'body' to a request") - LOG.warning(_LW("Use of 'body' is deprecated; use 'data' instead")) + LOG.warning("Use of 'body' is deprecated; use 'data' instead") kwargs['data'] = kwargs.pop('body') # Chunking happens automatically if 'body' is a # file-like object @@ -328,7 +326,7 @@ class SessionClient(keystone_adapter.Adapter): if 'data' in kwargs: raise ValueError("Can't provide both 'data' and " "'body' to a request") - LOG.warning(_LW("Use of 'body' is deprecated; use 'data' instead")) + LOG.warning("Use of 'body' is deprecated; use 'data' instead") kwargs['data'] = kwargs.pop('body') if 'data' in kwargs: kwargs['data'] = jsonutils.dumps(kwargs['data']) @@ -353,7 +351,7 @@ class SessionClient(keystone_adapter.Adapter): if 'data' in kwargs: raise ValueError("Can't provide both 'data' and " "'body' to a request") - LOG.warning(_LW("Use of 'body' is deprecated; use 'data' instead")) + LOG.warning("Use of 'body' is deprecated; use 'data' instead") kwargs['data'] = kwargs.pop('body') resp = keystone_adapter.Adapter.request(self, url, diff --git a/karborclient/i18n.py b/karborclient/i18n.py index 10324c2..d2a9ab2 100644 --- a/karborclient/i18n.py +++ b/karborclient/i18n.py @@ -23,16 +23,6 @@ _translators = oslo_i18n.TranslatorFactory(domain='karborclient') # The primary translation function using the well-known name "_" _ = _translators.primary -# 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('karborclient')