]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
immutable/checker: make log() tolerate the format= form
authorBrian Warner <warner@lothar.com>
Mon, 8 Sep 2008 03:03:08 +0000 (20:03 -0700)
committerBrian Warner <warner@lothar.com>
Mon, 8 Sep 2008 03:03:08 +0000 (20:03 -0700)
src/allmydata/immutable/checker.py

index 71b8e9dc2727162151b789d377db748190dd1d81..bfd7b66e52b1e65ed3490d3a00bc08b0f1e5994e 100644 (file)
@@ -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):