diff options
| author | Davanum Srinivas <dims@linux.vnet.ibm.com> | 2012-11-28 23:33:01 -0500 |
|---|---|---|
| committer | Davanum Srinivas <dims@linux.vnet.ibm.com> | 2012-11-28 23:33:01 -0500 |
| commit | 6d102bcf0cbacb1d37eec20c4d318e14724a056d (patch) | |
| tree | 83a30dddc1af8825a9e071b3a43a05f0759848f4 /openstack | |
| parent | cf705c59615fb68cdbfe664e7827e4a275a4a282 (diff) | |
| download | oslo-6d102bcf0cbacb1d37eec20c4d318e14724a056d.tar.gz oslo-6d102bcf0cbacb1d37eec20c4d318e14724a056d.tar.xz oslo-6d102bcf0cbacb1d37eec20c4d318e14724a056d.zip | |
Provide i18n to those messages without _()
bug 1081498
There are a few log messages without _(), but a lot messages with _().
Wrap these log messages with _() in order to make the code consistent.
fix missing imports for _
Pass the log message and interpolation argument(s) to the logger separately
remove extra parens
rework the patch against latest trunk
Change-Id: Ib0a7b0f9c57aadfbc2cfc477c6123b885c9c6060
Diffstat (limited to 'openstack')
| -rw-r--r-- | openstack/common/exception.py | 4 | ||||
| -rw-r--r-- | openstack/common/excutils.py | 6 | ||||
| -rw-r--r-- | openstack/common/rpc/amqp.py | 4 |
3 files changed, 9 insertions, 5 deletions
diff --git a/openstack/common/exception.py b/openstack/common/exception.py index 4866de2..fa06d6a 100644 --- a/openstack/common/exception.py +++ b/openstack/common/exception.py @@ -21,6 +21,8 @@ Exceptions common to OpenStack projects import logging +from openstack.common.gettextutils import _ + class Error(Exception): def __init__(self, message=None): @@ -97,7 +99,7 @@ def wrap_exception(f): except Exception, e: if not isinstance(e, Error): #exc_type, exc_value, exc_traceback = sys.exc_info() - logging.exception('Uncaught exception') + logging.exception(_('Uncaught exception')) #logging.error(traceback.extract_stack(exc_traceback)) raise Error(str(e)) raise diff --git a/openstack/common/excutils.py b/openstack/common/excutils.py index 5dd4830..c518310 100644 --- a/openstack/common/excutils.py +++ b/openstack/common/excutils.py @@ -24,6 +24,8 @@ import logging import sys import traceback +from openstack.common.gettextutils import _ + @contextlib.contextmanager def save_and_reraise_exception(): @@ -43,7 +45,7 @@ def save_and_reraise_exception(): try: yield except Exception: - logging.error('Original exception being dropped: %s' % - (traceback.format_exception(type_, value, tb))) + logging.error(_('Original exception being dropped: %s'), + traceback.format_exception(type_, value, tb)) raise raise type_, value, tb diff --git a/openstack/common/rpc/amqp.py b/openstack/common/rpc/amqp.py index 2ea506a..b247106 100644 --- a/openstack/common/rpc/amqp.py +++ b/openstack/common/rpc/amqp.py @@ -55,7 +55,7 @@ class Pool(pools.Pool): # TODO(comstud): Timeout connections not used in a while def create(self): - LOG.debug('Pool creating new connection') + LOG.debug(_('Pool creating new connection')) return self.connection_cls(self.conf) def empty(self): @@ -283,7 +283,7 @@ class ProxyCallback(object): # This final None tells multicall that it is done. ctxt.reply(ending=True, connection_pool=self.connection_pool) except Exception: - LOG.exception('Exception during message handling') + LOG.exception(_('Exception during message handling')) ctxt.reply(None, sys.exc_info(), connection_pool=self.connection_pool) |
