Translate info-level log messages for LOG.error

The Log "LOG.error(_LE(...)" is used in some places,
but the log "LOG.error(_(..))"  still used in a few places.

Change-Id: I1baff0eca5c6c5868b6908d3ea0008a553deb4cd
This commit is contained in:
gengchc2 2016-12-01 10:14:48 +08:00
parent 27770c8f28
commit 641d0ffe36
7 changed files with 20 additions and 20 deletions

View File

@ -200,7 +200,7 @@ class PollingTask(object):
self._send_notification(sample_batch)
except plugin_base.PollsterPermanentError as err:
LOG.error(_(
LOG.error(_LE(
'Prevent pollster %(name)s from '
'polling %(res_list)s on source %(source)s anymore!')
% ({'name': pollster.name, 'source': source_name,
@ -299,8 +299,8 @@ class AgentManager(service_base.PipelineBasedService):
LOG.exception(_LE("Skip loading extension for %s"), ep.name)
return
if isinstance(exc, ImportError):
LOG.error(_("Failed to import extension for %(name)s: "
"%(error)s"),
LOG.error(_LE("Failed to import extension for %(name)s: "
"%(error)s"),
{'name': ep.name, 'error': exc})
return
raise exc

View File

@ -33,7 +33,7 @@ from ceilometer.api.controllers.v2 import utils as v2_utils
from ceilometer.api import rbac
from ceilometer.event import storage
from ceilometer.event.storage import models as event_models
from ceilometer.i18n import _
from ceilometer.i18n import _, _LE
LOG = log.getLogger(__name__)
@ -315,8 +315,8 @@ class EventsController(rest.RestController):
raise base.EntityNotFound(_("Event"), message_id)
if len(events) > 1:
LOG.error(_("More than one event with "
"id %s returned from storage driver") % message_id)
LOG.error(_LE("More than one event with "
"id %s returned from storage driver") % message_id)
event = events[0]

View File

@ -27,7 +27,7 @@ import six
import webob
from ceilometer import i18n
from ceilometer.i18n import _
from ceilometer.i18n import _LE
LOG = log.getLogger(__name__)
@ -99,7 +99,7 @@ class ParsableErrorMiddleware(object):
error_message,
b'</error_message>'))
except etree.XMLSyntaxError as err:
LOG.error(_('Error parsing HTTP response: %s'), err)
LOG.error(_LE('Error parsing HTTP response: %s'), err)
error_message = state['status_code']
body = '<error_message>%s</error_message>' % error_message
if six.PY3:

View File

@ -21,7 +21,7 @@ from oslo_log import log
from stevedore import driver
import ceilometer
from ceilometer.i18n import _
from ceilometer.i18n import _LE
OPTS = [
@ -375,5 +375,5 @@ def get_hypervisor_inspector(conf):
invoke_args=(conf, ))
return mgr.driver
except ImportError as e:
LOG.error(_("Unable to load the hypervisor inspector: %s") % e)
LOG.error(_LE("Unable to load the hypervisor inspector: %s") % e)
return Inspector(conf)

View File

@ -17,7 +17,7 @@ from oslo_log import log
from oslo_utils import timeutils
from ceilometer.agent import plugin_base
from ceilometer.i18n import _
from ceilometer.i18n import _LE
from ceilometer import nova_client
@ -124,7 +124,7 @@ class NodesDiscoveryTripleO(plugin_base.DiscoveryBase):
resources.append(resource)
except KeyError:
LOG.error(_("Couldn't obtain IP address of "
"instance %s") % instance.id)
LOG.error(_LE("Couldn't obtain IP address of "
"instance %s") % instance.id)
return resources

View File

@ -19,7 +19,7 @@ import logging.handlers
from oslo_log import log
from six.moves.urllib import parse as urlparse
from ceilometer.i18n import _
from ceilometer.i18n import _LE
from ceilometer import publisher
LOG = log.getLogger(__name__)
@ -58,7 +58,7 @@ class FilePublisher(publisher.ConfigPublisherBase):
self.publisher_logger = None
path = parsed_url.path
if not path:
LOG.error(_('The path for the file publisher is required'))
LOG.error(_LE('The path for the file publisher is required'))
return
rfh = None
@ -72,8 +72,8 @@ class FilePublisher(publisher.ConfigPublisherBase):
max_bytes = int(params.get('max_bytes')[0])
backup_count = int(params.get('backup_count')[0])
except ValueError:
LOG.error(_('max_bytes and backup_count should be '
'numbers.'))
LOG.error(_LE('max_bytes and backup_count should be '
'numbers.'))
return
# create rotating file handler
rfh = logging.handlers.RotatingFileHandler(

View File

@ -26,7 +26,7 @@ import pymongo.errors
import six
from six.moves.urllib import parse
from ceilometer.i18n import _, _LI
from ceilometer.i18n import _, _LI, _LE
ERROR_INDEX_WITH_DIFFERENT_SPEC_ALREADY_EXISTS = 86
@ -405,8 +405,8 @@ def safe_mongo_call(call):
return call(self, *args, **kwargs)
except pymongo.errors.AutoReconnect as err:
if 0 <= max_retries <= attempts:
LOG.error(_('Unable to reconnect to the primary mongodb '
'after %(retries)d retries. Giving up.') %
LOG.error(_LE('Unable to reconnect to the primary mongodb '
'after %(retries)d retries. Giving up.') %
{'retries': max_retries})
raise
LOG.warning(_('Unable to reconnect to the primary '