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/simplejson/components/htmlfontify-example.html?a=commitdiff_plain;h=59770419cce31b04ec9b9b4413e733ce6cbb7ceb;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): """