Replace deprecated LOG.warn with LOG.warning

LOG.warn is deprecated in Python 3 [1] . But it still used in a few places, non-deprecated LOG.warning should be used instead.

Note: If we are using logger from oslo.log, warn is still valid [2], but I agree we can switch to LOG.warning.

[1]https://docs.python.org/3/library/logging.html#logging.warning
[2]https://github.com/openstack/oslo.log/blob/master/oslo_log/log.py#L85

Change-Id: Ibbcc287815cbc06162a13448c2dabcb0748e4e32
Closes-Bug: #1508442
This commit is contained in:
Erik Olof Gunnar Andersson 2018-04-03 14:28:01 -07:00
parent 7a2adab56a
commit 8bc3693c19
2 changed files with 6 additions and 6 deletions

View File

@ -554,11 +554,11 @@ class RecoverShard(base.Task):
stale_zones = self.storage.find_zones(self.context, stale_criterion) stale_zones = self.storage.find_zones(self.context, stale_criterion)
if stale_zones: if stale_zones:
LOG.warn('Found %(len)d zones PENDING for more than %(sec)d ' LOG.warning('Found %(len)d zones PENDING for more than %(sec)d '
'seconds', { 'seconds', {
'len': len(stale_zones), 'len': len(stale_zones),
'sec': self.max_prop_time 'sec': self.max_prop_time
}) })
error_zones.extend(stale_zones) error_zones.extend(stale_zones)
return error_zones return error_zones

View File

@ -207,7 +207,7 @@ See https://docs.openstack.org/oslo.i18n/latest/user/guidelines.html
LOG.debug("... %s", variable) LOG.debug("... %s", variable)
# Use named interpolation when more than one replacement is done # Use named interpolation when more than one replacement is done
LOG.info("... %(key)s ...", {'key': 'value', ...}) LOG.info("... %(key)s ...", {'key': 'value', ...})
LOG.warn("... %(key)s", {'key': 'value'}) LOG.warning("... %(key)s", {'key': 'value'})
LOG.error("... %(key)s", {'key': 'value'}) LOG.error("... %(key)s", {'key': 'value'})
LOG.critical("... %(key)s", {'key': 'value'}) LOG.critical("... %(key)s", {'key': 'value'})