From a79fc91b109f8aa01a7eae16810947d71029a91f Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 28 Dec 2020 17:58:41 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=B0=20Log=20dispenser=20actions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- royalnet/engineer/dispenser.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/royalnet/engineer/dispenser.py b/royalnet/engineer/dispenser.py index 013dd103..0103ed2e 100644 --- a/royalnet/engineer/dispenser.py +++ b/royalnet/engineer/dispenser.py @@ -26,7 +26,7 @@ class Dispenser: :param item: The item to insert. """ - log.debug(f"Putting {item}") + log.debug(f"Putting {item}...") for sentry in self.sentries: await sentry.put(item) @@ -36,11 +36,16 @@ class Dispenser: A context manager which creates a :class:`.SentrySource` and keeps it in :attr:`.sentries` while it is being used. """ + log.debug("Creating a new SentrySource...") sentry = SentrySource(dispenser=self, *args, **kwargs) + + log.debug(f"Adding: {sentry}") self.sentries.append(sentry) + log.debug(f"Yielding: {sentry}") yield sentry + log.debug(f"Removing from the sentries list: {sentry}") self.sentries.remove(sentry) async def run(self, conv: t.Conversation) -> None: @@ -49,11 +54,13 @@ class Dispenser: :param conv: The conversation to run. """ + log.debug(f"Running: {conv}") with self.sentry() as sentry: state = conv(_sentry=sentry) + log.debug(f"First state: {state}") while state := await state: - pass + log.debug(f"Switched to: {state}") __all__ = (