Browse Source

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
tags/7.0.0.0b1
Erik Olof Gunnar Andersson 1 year ago
parent
commit
8bc3693c19
2 changed files with 6 additions and 6 deletions
  1. 5
    5
      designate/worker/tasks/zone.py
  2. 1
    1
      doc/source/contributor/getting-involved.rst

+ 5
- 5
designate/worker/tasks/zone.py View File

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

+ 1
- 1
doc/source/contributor/getting-involved.rst View File

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

Loading…
Cancel
Save