]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Improve logging of HookMixin.
authorDaira Hopwood <daira@jacaranda.org>
Wed, 23 Sep 2015 14:34:15 +0000 (15:34 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Wed, 23 Sep 2015 14:34:15 +0000 (15:34 +0100)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/util/deferredutil.py

index ac6fa8a0d06be8b6d31968c2a6da44ba3a073383..9b37cb2761df056c7992d43bd824af1eff28041b 100644 (file)
@@ -90,6 +90,7 @@ class HookMixin:
         If d is not given, an unfired Deferred is created and returned.
         The hook must not already be set.
         """
+        self._log("set_hook %r, ignore_count=%r" % (name, ignore_count))
         if d is None:
             d = defer.Deferred()
         _assert(ignore_count >= 0, ignore_count=ignore_count)
@@ -118,7 +119,7 @@ class HookMixin:
             return defer.succeed(None)
 
         (d, ignore_count) = hook
-        log.msg("call_hook", name=name, ignore_count=ignore_count, level=log.NOISY)
+        self._log("call_hook %r, ignore_count=%r" % (name, ignore_count))
         if ignore_count > 0:
             self._hooks[name] = (d, ignore_count - 1)
         else:
@@ -126,6 +127,9 @@ class HookMixin:
             _with_log(d.callback, res)
         return res
 
+    def _log(self, msg):
+        log.msg(msg, level=log.NOISY)
+
 
 def async_iterate(process, iterable, *extra_args, **kwargs):
     """