Address G004 in flake8-logging-format 0.7.4
The current release of flake8-logging-format enforces G004 "Logging
statement uses f-string", so remove f-strings from log messages.
@@ -189,11 +189,14 @@ def synchronized(lock_name: str,
t1 = timeutils.now()
t2 = None
try:
- LOG.debug(f'Acquiring lock "{name}" by "{f_name}"')
+ LOG.debug('Acquiring lock "%(name)s" by "%(f_name)s"',
+ {'name': name, 'f_name': f_name})
with lock(blocking):
t2 = timeutils.now()
- LOG.debug(f'Lock "{name}" acquired by "{f_name}" :: '
- f'waited {t2 - t1:0.3f}s')
+ LOG.debug('Lock "%(name)s" acquired by "%(f_name)s" :: '
+ 'waited %(wait)s',
+ {'name': name, 'f_name': f_name,
+ 'wait': "%0.3fs" % (t2 - t1)})
return f(*a, **k)
finally:
t3 = timeutils.now()
@@ -202,6 +205,7 @@ def synchronized(lock_name: str,
else:
held_secs = "%0.3fs" % (t3 - t2)
LOG.debug(
- f'Lock "{name}" released by "{f_name}" :: held {held_secs}')
+ 'Lock "%(name)s" released by "%(f_name)s" :: held %(held)s',
+ {'name': name, 'f_name': f_name, 'held': held_secs})
return _synchronized
