mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-26 21:14:19 +00:00
📰 Log dispenser actions
This commit is contained in:
parent
69f50138ef
commit
a79fc91b10
1 changed files with 9 additions and 2 deletions
|
@ -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__ = (
|
||||
|
|
Loading…
Reference in a new issue