From e536057feaefb6c12f348096bacaf150a80067c3 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 4a1499a..0ac0dc4 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 c3deac9..1d3d4f1 100644 --- a/tractor/_root.py +++ b/tractor/_root.py @@ -342,7 +342,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