Merge "Fix improperly LOG using in Zaqar"
This commit is contained in:
commit
2bc8de46fe
@ -28,6 +28,8 @@ from zaqar.storage import utils as storage_utils
|
||||
from zaqar.transport import base
|
||||
from zaqar.transport import validation
|
||||
|
||||
from zaqar.i18n import _LE
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
@ -123,8 +125,8 @@ class Bootstrap(object):
|
||||
return mgr.driver
|
||||
except RuntimeError as exc:
|
||||
LOG.exception(exc)
|
||||
LOG.error(u'Failed to load transport driver zaqar.transport.'
|
||||
u'%(driver)s with args %(args)s',
|
||||
LOG.error(_LE(u'Failed to load transport driver zaqar.transport.'
|
||||
u'%(driver)s with args %(args)s'),
|
||||
{'driver': transport_name, 'args': args})
|
||||
raise errors.InvalidDriver(exc)
|
||||
|
||||
|
@ -19,6 +19,7 @@ import futurist
|
||||
from oslo_log import log as logging
|
||||
from six.moves import urllib_parse
|
||||
|
||||
from zaqar.i18n import _LE
|
||||
from zaqar.storage import pooling
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -51,4 +52,4 @@ class NotifierDriver(object):
|
||||
self.executor.submit(mgr.driver.execute, sub, messages,
|
||||
conf=data_driver.conf)
|
||||
else:
|
||||
LOG.error('Failed to get subscription controller.')
|
||||
LOG.error(_LE('Failed to get subscription controller.'))
|
||||
|
@ -43,8 +43,7 @@ class MailtoTask(object):
|
||||
msg["subject"] = params.get('subject', subject_opt)
|
||||
p.communicate(msg.as_string())
|
||||
except OSError as err:
|
||||
LOG.error(_LE('Failed to create process for sendmail, '
|
||||
'because %s') % str(err))
|
||||
LOG.exception(_LE('Failed to create process for sendmail, '
|
||||
'because %s.') % str(err))
|
||||
except Exception as exc:
|
||||
LOG.exception(_LE('Failed to send email'))
|
||||
LOG.exception(exc)
|
||||
LOG.exception(_LE('Failed to send email because %s.') % str(exc))
|
||||
|
@ -17,6 +17,8 @@ import json
|
||||
from oslo_log import log as logging
|
||||
import requests
|
||||
|
||||
from zaqar.i18n import _LE
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -29,4 +31,4 @@ class WebhookTask(object):
|
||||
data=json.dumps(msg),
|
||||
headers={'Content-Type': 'application/json'})
|
||||
except Exception as e:
|
||||
LOG.error(e)
|
||||
LOG.exception(_LE('webhook task got exception: %s.') % str(e))
|
||||
|
@ -28,7 +28,8 @@ from oslo_log import log as logging
|
||||
from oslo_utils import timeutils
|
||||
from pymongo import errors
|
||||
|
||||
from zaqar.i18n import _
|
||||
from zaqar.i18n import _LE
|
||||
from zaqar.i18n import _LW
|
||||
from zaqar.storage import errors as storage_errors
|
||||
|
||||
|
||||
@ -287,14 +288,14 @@ def retries_on_autoreconnect(func):
|
||||
break
|
||||
|
||||
except errors.AutoReconnect as ex:
|
||||
LOG.warning(_(u'Caught AutoReconnect, retrying the '
|
||||
'call to {0}').format(func))
|
||||
LOG.warning(_LW(u'Caught AutoReconnect, retrying the '
|
||||
'call to {0}').format(func))
|
||||
|
||||
last_ex = ex
|
||||
time.sleep(sleep_sec * (2 ** attempt))
|
||||
else:
|
||||
LOG.error(_(u'Caught AutoReconnect, maximum attempts '
|
||||
'to {0} exceeded.').format(func))
|
||||
LOG.error(_LE(u'Caught AutoReconnect, maximum attempts '
|
||||
'to {0} exceeded.').format(func))
|
||||
|
||||
raise last_ex
|
||||
|
||||
|
@ -23,7 +23,8 @@ from oslo_utils import encodeutils
|
||||
import redis
|
||||
import six
|
||||
|
||||
from zaqar.i18n import _
|
||||
from zaqar.i18n import _LE
|
||||
from zaqar.i18n import _LW
|
||||
from zaqar.storage import errors
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -210,13 +211,13 @@ def retries_on_connection_error(func):
|
||||
# MasterNotFoundError.
|
||||
|
||||
ex = sys.exc_info()[1]
|
||||
LOG.warning(_(u'Caught ConnectionError, retrying the '
|
||||
'call to {0}').format(func))
|
||||
LOG.warning(_LW(u'Caught ConnectionError, retrying the '
|
||||
'call to {0}').format(func))
|
||||
|
||||
time.sleep(sleep_sec * (2 ** attempt))
|
||||
else:
|
||||
LOG.error(_(u'Caught ConnectionError, maximum attempts '
|
||||
'to {0} exceeded.').format(func))
|
||||
LOG.error(_LE(u'Caught ConnectionError, maximum attempts '
|
||||
'to {0} exceeded.').format(func))
|
||||
raise ex
|
||||
|
||||
return wrapper
|
||||
|
@ -21,6 +21,7 @@ from stevedore import driver
|
||||
|
||||
from zaqar.common import errors
|
||||
from zaqar.common import utils
|
||||
from zaqar.i18n import _LE
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
@ -140,8 +141,8 @@ def load_storage_driver(conf, cache, storage_type=None,
|
||||
return mgr.driver
|
||||
|
||||
except Exception as exc:
|
||||
LOG.error('Failed to load "{}" driver for "{}"'.format(driver_type,
|
||||
storage_type))
|
||||
LOG.error(_LE('Failed to load "{}" driver for "{}"').format(
|
||||
driver_type, storage_type))
|
||||
LOG.exception(exc)
|
||||
raise errors.InvalidDriver(exc)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user