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: I2b1b343c9b6689b8c0e61be72f2a8cfa55688dd5
This commit is contained in:
liusheng 2017-07-12 15:09:28 +08:00
parent 6ed8dd3ffc
commit e134978327
6 changed files with 14 additions and 29 deletions

View File

@ -29,7 +29,6 @@ from six.moves.urllib import parse
from moganclient.common import exceptions as exc
from moganclient.common.i18n import _
from moganclient.common.i18n import _LW
from moganclient.common import utils
LOG = logging.getLogger(__name__)
@ -55,7 +54,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):

View File

@ -15,17 +15,5 @@
import oslo_i18n
_translators = oslo_i18n.TranslatorFactory(domain='moganclient')
# 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
_ = oslo_i18n.TranslatorFactory(domain='moganclient').primary

View File

@ -15,7 +15,6 @@
import logging
from moganclient.common.i18n import _LE
LOG = logging.getLogger(__name__)
@ -27,12 +26,12 @@ def get_response_body(resp):
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')
elif 'application/octet-stream' in content_type:
try:
body = resp.body()
except ValueError:
LOG.error(_LE('Could not decode response body as raw'))
LOG.error('Could not decode response body as raw')
else:
body = None
return body

View File

@ -122,8 +122,8 @@ class DeleteFlavor(command.Command):
bc_client.flavor.delete(data.uuid)
except Exception as e:
result += 1
LOG.error(_("Failed to delete flavor with name or UUID "
"'%(flavor)s': %(e)s") %
LOG.error("Failed to delete flavor with name or UUID "
"'%(flavor)s': %(e)s",
{'flavor': one_flavor, 'e': e})
if result > 0:
@ -200,7 +200,7 @@ class SetFlavor(command.Command):
bc_client.flavor.add_tenant_access(
data, parsed_args.project)
except Exception as e:
LOG.error(_("Failed to set flavor access to project: %s"), e)
LOG.error("Failed to set flavor access to project: %s", e)
result += 1
if result > 0:
@ -268,8 +268,7 @@ class UnsetFlavor(command.Command):
bc_client.flavor.remove_tenant_access(
data, parsed_args.project)
except Exception as e:
LOG.error(_("Failed to remove flavor access to project: "
"%s"), e)
LOG.error("Failed to remove flavor access to project: %s", e)
result += 1
if result > 0:

View File

@ -109,8 +109,8 @@ class DeleteKeyPair(command.Command):
bc_client.keypair.delete(one_key, parsed_args.user)
except Exception as e:
result += 1
LOG.error(_("Failed to delete keypair with name "
"'%(key)s': %(e)s") %
LOG.error("Failed to delete keypair with name "
"'%(key)s': %(e)s",
{'key': one_key, 'e': e})
if result > 0:

View File

@ -54,8 +54,8 @@ class ServersActionBase(command.Command):
method(data.uuid, **kwargs)
except Exception as e:
result += 1
LOG.error(_("Failed to %(action)s server with name or UUID "
"'%(server)s': %(e)s") %
LOG.error("Failed to %(action)s server with name or UUID "
"'%(server)s': %(e)s",
{'action': action, 'server': one_server, 'e': e})
if result > 0:
@ -253,8 +253,8 @@ class DeleteServer(command.Command):
bc_client.server.delete(data.uuid)
except Exception as e:
result += 1
LOG.error(_("Failed to delete server with name or UUID "
"'%(server)s': %(e)s") %
LOG.error("Failed to delete server with name or UUID "
"'%(server)s': %(e)s",
{'server': one_server, 'e': e})
if result > 0: