From fc56de8842cb2698503f8a78b7f333dff7fa77a3 Mon Sep 17 00:00:00 2001 From: Sergei Trofimov Date: Thu, 25 Jan 2018 08:37:33 +0000 Subject: [PATCH] framework/instruments: add ManagedCallback __repr__ Add a __repr__ for ManagedCallback callback to prove a useful representation in logging. --- wa/framework/instruments.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wa/framework/instruments.py b/wa/framework/instruments.py index 1fc8a0e3..053a8fc7 100644 --- a/wa/framework/instruments.py +++ b/wa/framework/instruments.py @@ -280,6 +280,12 @@ class ManagedCallback(object): else: raise + def __repr__(self): + text = 'ManagedCallback({}, {})' + return text.format(self.instrument.name, self.callback.im_func.func_name) + + __str__ = __repr__ + # Need this to keep track of callbacks, because the dispatcher only keeps # weak references, so if the callbacks aren't referenced elsewhere, they will