Replace LOG.warn with LOG.warning

Python 3 deprecated the logger.warn method.
we prefer to use warning to avoid DeprecationWarning.
refer to:
https://docs.python.org/3/library/logging.html#logging.warning

Change-Id: Ib85c55feabad8650661ea7fa521ba3093b07857b
This commit is contained in:
Chaozhe.Chen 2015-12-30 18:21:03 +08:00
parent ff5fc2c9e3
commit b0e6c64248
3 changed files with 7 additions and 7 deletions

View File

@ -134,8 +134,8 @@ class ThresholdEvaluator(evaluator.Evaluator):
"""
sufficient = len(statistics) >= alarm.rule['evaluation_periods']
if not sufficient and alarm.state != evaluator.UNKNOWN:
LOG.warn(_LW('Expecting %(expected)d datapoints but only get '
'%(actual)d') % {
LOG.warning(_LW('Expecting %(expected)d datapoints but only get '
'%(actual)d') % {
'expected': alarm.rule['evaluation_periods'],
'actual': len(statistics)})
# Reason is not same as log message because we want to keep

View File

@ -227,9 +227,9 @@ def create_tables(conn, tables, column_families):
separator=conn.table_prefix_separator,
table_name=table))
LOG.warn(_("Cannot create table %(table_name)s "
"it already exists. Ignoring error")
% {'table_name': table})
LOG.warning(_("Cannot create table %(table_name)s "
"it already exists. Ignoring error")
% {'table_name': table})
def quote(s, *args):

View File

@ -82,8 +82,8 @@ class ConnectionPool(object):
retry_interval,
)
except pymongo.errors.ConnectionFailure as e:
LOG.warn(_('Unable to connect to the database server: '
'%(errmsg)s.') % {'errmsg': e})
LOG.warning(_('Unable to connect to the database server: '
'%(errmsg)s.') % {'errmsg': e})
raise
self._pool[pool_key] = weakref.ref(client)
return client