Skip to content

Commit

Permalink
chore: make debug logs less ugly more useful (#328)
Browse files Browse the repository at this point in the history
* chore: make debug logs less ugly more useful

* Update executor.py

* fix: slicing

* feat: include module
  • Loading branch information
BobTheBuidler authored Oct 18, 2024
1 parent f9e8882 commit eb27f70
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions a_sync/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,20 @@ 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)
fnid = getattr(fn, '__qualname__', fn.__name__)
if fn.__module__:
fnid = f"{fn.__module__}.{fnid}"

msg = f"%s processing %s{args}{kwargs}"
msg = f"%s processing %s{args}"
if kwargs:
msg = f"{msg[:-1]} {', '.join(f'{k}={v}' for k, v in kwargs.items())})"
else:
msg = f"{msg[:-2]})"

while not fut.done():
await asyncio.sleep(15)
if not fut.done():
self.logger.debug(msg, self, fn)
self.logger.debug(msg, self, fnid)

# Process

Expand Down

0 comments on commit eb27f70

Please sign in to comment.