From f9e88829325417c0be8faf986ff2f26185954e48 Mon Sep 17 00:00:00 2001 From: BobTheBuidler <70677534+BobTheBuidler@users.noreply.github.com> Date: Wed, 16 Oct 2024 21:53:01 -0400 Subject: [PATCH] chore: use function qualname for cleaner debug daemon logs (#327) * chore: use function qualname for cleaner debug daemon logs --- a_sync/executor.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/a_sync/executor.py b/a_sync/executor.py index 5ed44395..88fd6c13 100644 --- a/a_sync/executor.py +++ b/a_sync/executor.py @@ -112,10 +112,16 @@ async def _debug_daemon(self, fut: asyncio.Future, fn, *args, **kwargs) -> None: *args: Positional arguments for the function. **kwargs: Keyword arguments for the function. """ + # TODO: make prettier strings for other types + if type(fn).__name__ == "function": + fn = getattr(fn, '__qualname__', fn) + + msg = f"%s processing %s{args}{kwargs}" + while not fut.done(): await asyncio.sleep(15) if not fut.done(): - self.logger.debug(f'{self} processing {fn}{args}{kwargs}') + self.logger.debug(msg, self, fn) # Process