From f62075a47e8e31e55d7cae6787099174fe75816b Mon Sep 17 00:00:00 2001 From: BobTheBuidler <70677534+BobTheBuidler@users.noreply.github.com> Date: Wed, 16 Oct 2024 21:39:19 -0400 Subject: [PATCH 1/2] chore: use function qualname for cleaner debug daemon logs --- a_sync/executor.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/a_sync/executor.py b/a_sync/executor.py index 5ed44395..8feaf4b7 100644 --- a/a_sync/executor.py +++ b/a_sync/executor.py @@ -112,6 +112,10 @@ 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) + while not fut.done(): await asyncio.sleep(15) if not fut.done(): From af28d6991db563e0c3a9cdf7cd23029ae556c0bc Mon Sep 17 00:00:00 2001 From: BobTheBuidler <70677534+BobTheBuidler@users.noreply.github.com> Date: Wed, 16 Oct 2024 21:42:41 -0400 Subject: [PATCH 2/2] chore: reuse msg --- a_sync/executor.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/a_sync/executor.py b/a_sync/executor.py index 8feaf4b7..88fd6c13 100644 --- a/a_sync/executor.py +++ b/a_sync/executor.py @@ -115,11 +115,13 @@ async def _debug_daemon(self, fut: asyncio.Future, fn, *args, **kwargs) -> None: # 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