From: Daira Hopwood Date: Wed, 23 Sep 2015 14:34:15 +0000 (+0100) Subject: Improve logging of HookMixin. X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/flags/(%5B%5E?a=commitdiff_plain;h=8db6e141e079a0e91763b74ba5e8c978d185b2cb;p=tahoe-lafs%2Ftahoe-lafs.git Improve logging of HookMixin. Signed-off-by: Daira Hopwood --- diff --git a/src/allmydata/util/deferredutil.py b/src/allmydata/util/deferredutil.py index ac6fa8a0..9b37cb27 100644 --- a/src/allmydata/util/deferredutil.py +++ b/src/allmydata/util/deferredutil.py @@ -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): """