From 04aea5c4db64bd5431aee407a2c1dcec8930651e Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 29 Feb 2024 20:01:39 -0500 Subject: [PATCH] Add field-first subproca `.info()` to `._entry` --- tractor/_entry.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/tractor/_entry.py b/tractor/_entry.py index e8fb56db..23dd05b6 100644 --- a/tractor/_entry.py +++ b/tractor/_entry.py @@ -106,25 +106,25 @@ def _trio_main( Entry point for a `trio_run_in_process` subactor. ''' - log.info(f"Started new trio process for {actor.uid}") - - if actor.loglevel is not None: - log.info( - f"Setting loglevel for {actor.uid} to {actor.loglevel}") - get_console_log(actor.loglevel) - - log.info( - f"Started {actor.uid}") - _state._current_actor = actor - - log.debug(f"parent_addr is {parent_addr}") trio_main = partial( async_main, actor, parent_addr=parent_addr ) + if actor.loglevel is not None: + get_console_log(actor.loglevel) + import os + log.info( + 'Started new trio process:\n' + f'|_{actor}\n' + f' uid: {actor.uid}\n' + f' pid: {os.getpid()}\n' + f' parent_addr: {parent_addr}\n' + f' loglevel: {actor.loglevel}\n' + ) + try: if infect_asyncio: actor._infected_aio = True @@ -132,7 +132,9 @@ def _trio_main( else: trio.run(trio_main) except KeyboardInterrupt: - log.cancel(f"Actor {actor.uid} received KBI") + log.cancel( + f'@{actor.uid} received KBI' + ) finally: log.info(f"Actor {actor.uid} terminated")