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: Ide6c0b2a565aa77b2bbef71c6652edf1e2ac2017
This commit is contained in:
blue55 2017-03-21 14:19:33 +08:00
parent 414a35768d
commit 9ec0b9e66b
5 changed files with 8 additions and 34 deletions

View File

@ -17,9 +17,6 @@ import os_vif.exception
import os_vif.i18n
import os_vif.objects
_LE = os_vif.i18n._LE
_LI = os_vif.i18n._LI
_EXT_MANAGER = None
LOG = logging.getLogger(__name__)
@ -49,7 +46,7 @@ def initialize(reset=False):
{'cls': cls, 'plugin_name': plugin_name})
loaded_plugins.append(plugin_name)
_EXT_MANAGER[plugin_name].obj = obj
LOG.info(_LI("Loaded VIF plugins: %s"), ", ".join(loaded_plugins))
LOG.info("Loaded VIF plugins: %s", ", ".join(loaded_plugins))
def plug(vif, instance_info):
@ -78,9 +75,9 @@ def plug(vif, instance_info):
try:
LOG.debug("Plugging vif %s", vif)
plugin.plug(vif, instance_info)
LOG.info(_LI("Successfully plugged vif %s"), vif)
LOG.info("Successfully plugged vif %s", vif)
except Exception as err:
LOG.error(_LE("Failed to plug vif %(vif)s"),
LOG.error("Failed to plug vif %(vif)s",
{"vif": vif}, exc_info=True)
raise os_vif.exception.PlugException(vif=vif, err=err)
@ -111,9 +108,9 @@ def unplug(vif, instance_info):
try:
LOG.debug("Unplugging vif %s", vif)
plugin.unplug(vif, instance_info)
LOG.info(_LI("Successfully unplugged vif %s"), vif)
LOG.info("Successfully unplugged vif %s", vif)
except Exception as err:
LOG.error(_LE("Failed to unplug vif %(vif)s"),
LOG.error("Failed to unplug vif %(vif)s",
{"vif": vif}, exc_info=True)
raise os_vif.exception.UnplugException(vif=vif, err=err)

View File

@ -27,16 +27,6 @@ _translators = oslo_i18n.TranslatorFactory(domain=DOMAIN)
# 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 translate(value, user_locale):
return oslo_i18n.translate(value, user_locale)

View File

@ -17,8 +17,6 @@ import re
from oslo_versionedobjects import fields
import six
from os_vif.i18n import _LE
class PCIAddress(fields.FieldType):
@ -30,7 +28,7 @@ class PCIAddress(fields.FieldType):
newvalue = value.lower()
if PCIAddress._REGEX.match(newvalue):
return newvalue
raise ValueError(_LE("Malformed PCI address %s"), value)
raise ValueError("Malformed PCI address %s", value)
class PCIAddressField(fields.AutoTypedField):

View File

@ -30,16 +30,6 @@ _translators = oslo_i18n.TranslatorFactory(domain=DOMAIN)
# 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 translate(value, user_locale):
return oslo_i18n.translate(value, user_locale)

View File

@ -28,7 +28,6 @@ from oslo_utils import excutils
from vif_plug_ovs import constants
from vif_plug_ovs import exception
from vif_plug_ovs.i18n import _LE
from vif_plug_ovs import privsep
LOG = logging.getLogger(__name__)
@ -42,7 +41,7 @@ def _ovs_vsctl(args, timeout=None):
try:
return processutils.execute(*full_args)
except Exception as e:
LOG.error(_LE("Unable to execute %(cmd)s. Exception: %(exception)s"),
LOG.error("Unable to execute %(cmd)s. Exception: %(exception)s",
{'cmd': full_args, 'exception': e})
raise exception.AgentError(method=full_args)
@ -105,7 +104,7 @@ def _delete_net_dev(dev):
LOG.debug("Net device removed: '%s'", dev)
except processutils.ProcessExecutionError:
with excutils.save_and_reraise_exception():
LOG.error(_LE("Failed removing net device: '%s'"), dev)
LOG.error("Failed removing net device: '%s'", dev)
@privsep.vif_plug.entrypoint