From af2231563ed270d6f5e20951d21cab1285b259c3 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Sun, 7 Sep 2008 20:03:08 -0700 Subject: [PATCH] immutable/checker: make log() tolerate the format= form --- src/allmydata/immutable/checker.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/allmydata/immutable/checker.py b/src/allmydata/immutable/checker.py index 71b8e9dc..bfd7b66e 100644 --- a/src/allmydata/immutable/checker.py +++ b/src/allmydata/immutable/checker.py @@ -165,12 +165,19 @@ class SimpleCHKFileVerifier(download.FileDownloader): num = self._client.log("SimpleCHKFileVerifier(%s): starting" % prefix) self._log_number = num - def log(self, msg, *args, **kwargs): - if not kwargs.get('parent'): + def log(self, *args, **kwargs): + if not "parent" in kwargs: kwargs['parent'] = self._log_number - return self._client.log("SimpleCHKFileVerifier(%s): %s" - % (self._log_prefix, msg), - *args, **kwargs) + # add a prefix to the message, regardless of how it is expressed + prefix = "SimpleCHKFileVerifier(%s): " % self._log_prefix + if "format" in kwargs: + kwargs["format"] = prefix + kwargs["format"] + elif "message" in kwargs: + kwargs["message"] = prefix + kwargs["message"] + elif args: + m = prefix + args[0] + args = (m,) + args[1:] + return self._client.log(*args, **kwargs) def start(self): -- 2.45.2