From 2dc2cf3c31ca14ac2d4894b1cd98a4d8e4a76b9d Mon Sep 17 00:00:00 2001 From: lioplhp Date: Thu, 23 Mar 2017 18:05:16 +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: I797b5f0374d6f8ca1cb4641246cab414aa5466dd --- oslo_middleware/_i18n.py | 10 ---------- oslo_middleware/catch_errors.py | 5 ++--- oslo_middleware/healthcheck/disable_by_file.py | 11 +++++------ 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/oslo_middleware/_i18n.py b/oslo_middleware/_i18n.py index f9bbda1..250ed62 100644 --- a/oslo_middleware/_i18n.py +++ b/oslo_middleware/_i18n.py @@ -23,13 +23,3 @@ _translators = oslo_i18n.TranslatorFactory(domain='oslo_middleware') # 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 diff --git a/oslo_middleware/catch_errors.py b/oslo_middleware/catch_errors.py index 8ffd252..220d704 100644 --- a/oslo_middleware/catch_errors.py +++ b/oslo_middleware/catch_errors.py @@ -19,7 +19,6 @@ import re import webob.dec import webob.exc -from oslo_middleware._i18n import _LE from oslo_middleware import base @@ -41,7 +40,7 @@ class CatchErrors(base.ConfigurableMiddleware): response = req.get_response(self.application) except Exception: req_str = _TOKEN_RE.sub(r'\1: *****', req.as_text()) - LOG.exception(_LE('An error occurred during ' - 'processing the request: %s'), req_str) + LOG.exception('An error occurred during ' + 'processing the request: %s', req_str) response = webob.exc.HTTPInternalServerError() return response diff --git a/oslo_middleware/healthcheck/disable_by_file.py b/oslo_middleware/healthcheck/disable_by_file.py index c1eafa8..cc99c08 100644 --- a/oslo_middleware/healthcheck/disable_by_file.py +++ b/oslo_middleware/healthcheck/disable_by_file.py @@ -16,7 +16,6 @@ import logging import os -from oslo_middleware._i18n import _LW from oslo_middleware.healthcheck import opts from oslo_middleware.healthcheck import pluginbase @@ -66,9 +65,9 @@ class DisableByFilesPortsHealthcheck(pluginbase.HealthcheckBaseExtension): def healthcheck(self, server_port): path = self.status_files.get(server_port) if not path: - LOG.warning(_LW('DisableByFilesPorts healthcheck middleware' - ' enabled without disable_by_file_paths set' - ' for port %s') % server_port) + LOG.warning('DisableByFilesPorts healthcheck middleware' + ' enabled without disable_by_file_paths set' + ' for port %s', server_port) return pluginbase.HealthcheckResult(available=True, reason="OK") else: @@ -107,8 +106,8 @@ class DisableByFileHealthcheck(pluginbase.HealthcheckBaseExtension): def healthcheck(self, server_port): path = self._conf_get('disable_by_file_path') if not path: - LOG.warning(_LW('DisableByFile healthcheck middleware enabled ' - 'without disable_by_file_path set')) + LOG.warning('DisableByFile healthcheck middleware enabled ' + 'without disable_by_file_path set') return pluginbase.HealthcheckResult( available=True, reason="OK", details="No 'disable_by_file_path' configuration value"