From 65dd2e510f48d4e5309fb550c9495be5b4bad253 Mon Sep 17 00:00:00 2001 From: Angus Lees Date: Mon, 22 Dec 2014 15:38:40 +1100 Subject: [PATCH] bigswitch: Use lazy logging interpolation There are a small number of examples of "eager" interpolation in neutron: logging.debug("foo %s" % arg) These should be converted to perform the interpolation lazily within the logging function, since if the severity is below the logging level then the interpolation can be skipped entirely. This change addresses all such examples found in bigswitch via a pylint test. Other occurrences are addressed elsewhere. Change-Id: I23fd4e7d0e4173e753a124d62a1563ce6ac674ca Partial-Bug: #1404788 --- neutron/plugins/bigswitch/db/consistency_db.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/neutron/plugins/bigswitch/db/consistency_db.py b/neutron/plugins/bigswitch/db/consistency_db.py index f9dd8d1eacb..641e1b3235a 100644 --- a/neutron/plugins/bigswitch/db/consistency_db.py +++ b/neutron/plugins/bigswitch/db/consistency_db.py @@ -155,7 +155,7 @@ class HashHandler(object): # for new lock ID to be removed LOG.debug( "Failed to acquire lock. Restarting lock wait. " - "Previous hash: %(prev)s. Attempted update: %(new)s" % + "Previous hash: %(prev)s. Attempted update: %(new)s", {'prev': res.hash, 'new': new}) time.sleep(0.25) continue @@ -163,7 +163,7 @@ class HashHandler(object): return res.hash LOG.debug("This request's lock ID is %(this)s. " - "DB lock held by %(that)s" % + "DB lock held by %(that)s", {'this': self.random_lock_id, 'that': current_lock_owner}) @@ -197,7 +197,7 @@ class HashHandler(object): "the DB first.")) def clear_lock(self): - LOG.debug("Clearing hash record lock of id %s" % self.random_lock_id) + LOG.debug("Clearing hash record lock of id %s", self.random_lock_id) with self.session.begin(subtransactions=True): res = (self.session.query(ConsistencyHash). filter_by(hash_id=self.hash_id).first())