From 8db6e141e079a0e91763b74ba5e8c978d185b2cb Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Wed, 23 Sep 2015 15:34:15 +0100 Subject: [PATCH] Improve logging of HookMixin. Signed-off-by: Daira Hopwood --- src/allmydata/util/deferredutil.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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): """ -- 2.45.2