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: Ia1c55fc10a10b03baa43779e1f5648ce62e91c14
Closes-Bug: 1674577
This commit is contained in:
hnyang 2017-03-21 14:01:44 +08:00
parent 6e04f882c4
commit 824adacdfc
3 changed files with 14 additions and 25 deletions

View File

@ -25,13 +25,3 @@ _translators = oslo_i18n.TranslatorFactory(domain='oslo_utils')
# 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

View File

@ -26,7 +26,7 @@ import traceback
import six
from oslo_utils._i18n import _LE
from oslo_utils import encodeutils
from oslo_utils import reflection
from oslo_utils import timeutils
@ -211,7 +211,7 @@ class save_and_reraise_exception(object):
def __exit__(self, exc_type, exc_val, exc_tb):
if exc_type is not None:
if self.reraise:
self.logger.error(_LE('Original exception being dropped: %s'),
self.logger.error('Original exception being dropped: %s',
traceback.format_exception(self.type_,
self.value,
self.tb))
@ -258,8 +258,8 @@ def forever_retry_uncaught_exceptions(*args, **kwargs):
# The watch has expired or the exception message
# changed, so time to log it again...
logging.exception(
_LE('Unexpected exception occurred %d time(s)... '
'retrying.') % same_failure_count)
'Unexpected exception occurred %d time(s)... '
'retrying.' % same_failure_count)
if not watch.has_started():
watch.start()
else:

View File

@ -28,8 +28,7 @@ import six
from six.moves.urllib import parse
from oslo_utils._i18n import _
from oslo_utils._i18n import _LI
from oslo_utils._i18n import _LW
LOG = logging.getLogger(__name__)
_IS_IPV6_ENABLED = None
@ -330,19 +329,19 @@ def _get_my_ipv4_address():
try:
interface = gtw['default'][netifaces.AF_INET][1]
except (KeyError, IndexError):
LOG.info(_LI('Could not determine default network interface, '
'using 127.0.0.1 for IPv4 address'))
LOG.info('Could not determine default network interface, '
'using 127.0.0.1 for IPv4 address')
return LOCALHOST
try:
return netifaces.ifaddresses(interface)[netifaces.AF_INET][0]['addr']
except (KeyError, IndexError):
LOG.info(_LI('Could not determine IPv4 address for interface %s, '
'using 127.0.0.1'),
LOG.info('Could not determine IPv4 address for interface %s, '
'using 127.0.0.1',
interface)
except Exception as e:
LOG.info(_LI('Could not determine IPv4 address for '
'interface %(interface)s: %(error)s'),
LOG.info('Could not determine IPv4 address for '
'interface %(interface)s: %(error)s',
{'interface': interface, 'error': e})
return LOCALHOST
@ -437,18 +436,18 @@ def set_tcp_keepalive(sock, tcp_keepalive=True,
socket.TCP_KEEPIDLE,
tcp_keepidle)
else:
LOG.warning(_LW('tcp_keepidle not available on your system'))
LOG.warning('tcp_keepidle not available on your system')
if tcp_keepalive_interval is not None:
if hasattr(socket, 'TCP_KEEPINTVL'):
sock.setsockopt(socket.IPPROTO_TCP,
socket.TCP_KEEPINTVL,
tcp_keepalive_interval)
else:
LOG.warning(_LW('tcp_keepintvl not available on your system'))
LOG.warning('tcp_keepintvl not available on your system')
if tcp_keepalive_count is not None:
if hasattr(socket, 'TCP_KEEPCNT'):
sock.setsockopt(socket.IPPROTO_TCP,
socket.TCP_KEEPCNT,
tcp_keepalive_count)
else:
LOG.warning(_LW('tcp_keepcnt not available on your system'))
LOG.warning('tcp_keepcnt not available on your system')