replace string format arguments with function parameters

There are files containing string format arguments inside
logging messages. Using logging function parameters should
be preferred.

Change-Id: I1c2a4f43463932e85c75d576241d0c0455c38492
This commit is contained in:
Christian Berendt 2014-05-20 11:39:13 +02:00
parent fd54207d3f
commit ac2dbb0f1f
2 changed files with 10 additions and 7 deletions

View File

@ -540,8 +540,9 @@ def drop_buffer_cache(fd, offset, length):
ret = _posix_fadvise(fd, ctypes.c_uint64(offset), ret = _posix_fadvise(fd, ctypes.c_uint64(offset),
ctypes.c_uint64(length), 4) ctypes.c_uint64(length), 4)
if ret != 0: if ret != 0:
logging.warn("posix_fadvise64(%s, %s, %s, 4) -> %s" logging.warn("posix_fadvise64(%(fd)s, %(offset)s, %(length)s, 4) "
% (fd, offset, length, ret)) "-> %(ret)s", {'fd': fd, 'offset': offset,
'length': length, 'ret': ret})
def normalize_timestamp(timestamp): def normalize_timestamp(timestamp):
@ -1546,7 +1547,7 @@ def item_from_env(env, item_name, allow_none=False):
""" """
item = env.get(item_name, None) item = env.get(item_name, None)
if item is None and not allow_none: if item is None and not allow_none:
logging.error("ERROR: %s could not be found in env!" % item_name) logging.error("ERROR: %s could not be found in env!", item_name)
return item return item

View File

@ -233,8 +233,9 @@ def hash_suffix(path, reclaim_age):
device_path = dirname(objects_path) device_path = dirname(objects_path)
quar_path = quarantine_renamer(device_path, hsh_path) quar_path = quarantine_renamer(device_path, hsh_path)
logging.exception( logging.exception(
_('Quarantined %s to %s because it is not a directory') % _('Quarantined %(hsh_path)s to %(quar_path)s because '
(hsh_path, quar_path)) 'it is not a directory'), {'hsh_path': hsh_path,
'quar_path': quar_path})
continue continue
raise raise
if not files: if not files:
@ -543,8 +544,9 @@ class DiskFileManager(object):
if err.errno == errno.ENOTDIR: if err.errno == errno.ENOTDIR:
quar_path = quarantine_renamer(dev_path, object_path) quar_path = quarantine_renamer(dev_path, object_path)
logging.exception( logging.exception(
_('Quarantined %s to %s because it is not a ' _('Quarantined %(object_path)s to %(quar_path)s because '
'directory') % (object_path, quar_path)) 'it is not a directory'), {'object_path': object_path,
'quar_path': quar_path})
raise DiskFileNotExist() raise DiskFileNotExist()
if err.errno != errno.ENOENT: if err.errno != errno.ENOENT:
raise raise