From ffed35e263124cc75c17fc0fddc0196f9a8e0e2c Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 5 Mar 2024 12:30:09 -0500 Subject: [PATCH] `._entry`: use same msg info in start/terminate log --- tractor/_entry.py | 18 ++++++++++++++---- tractor/_root.py | 4 +++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/tractor/_entry.py b/tractor/_entry.py index 23dd05b6..a59975ce 100644 --- a/tractor/_entry.py +++ b/tractor/_entry.py @@ -116,14 +116,18 @@ def _trio_main( if actor.loglevel is not None: get_console_log(actor.loglevel) import os - log.info( - 'Started new trio process:\n' + actor_info: str = ( f'|_{actor}\n' f' uid: {actor.uid}\n' f' pid: {os.getpid()}\n' f' parent_addr: {parent_addr}\n' f' loglevel: {actor.loglevel}\n' ) + log.info( + 'Started new trio process:\n' + + + actor_info + ) try: if infect_asyncio: @@ -133,8 +137,14 @@ def _trio_main( trio.run(trio_main) except KeyboardInterrupt: log.cancel( - f'@{actor.uid} received KBI' + 'Actor received KBI\n' + + + actor_info ) finally: - log.info(f"Actor {actor.uid} terminated") + log.info( + 'Actor terminated\n' + + + actor_info + ) diff --git a/tractor/_root.py b/tractor/_root.py index 88df774f..7c951df4 100644 --- a/tractor/_root.py +++ b/tractor/_root.py @@ -256,7 +256,9 @@ async def open_root_actor( # for an in nurseries: # tempn.start_soon(an.exited.wait) - logger.cancel("Shutting down root actor") + logger.info( + 'Closing down root actor' + ) await actor.cancel(None) # self cancel finally: _state._current_actor = None