forked from goodboy/tractor
1
0
Fork 0

"Icons" in `._entry`'s subactor `.info()` messages

Add a little `>` or `X` supervision icon indicating the spawning or
termination of each sub-actor respectively.
runtime_to_msgspec
Tyler Goodlet 2024-05-06 13:12:44 -04:00
parent 7707e0e75a
commit 8ffa6a5e68
1 changed files with 8 additions and 3 deletions

View File

@ -20,6 +20,7 @@ Sub-process entry points.
""" """
from __future__ import annotations from __future__ import annotations
from functools import partial from functools import partial
# import textwrap
from typing import ( from typing import (
Any, Any,
TYPE_CHECKING, TYPE_CHECKING,
@ -91,7 +92,7 @@ def _mp_main(
pass # handle it the same way trio does? pass # handle it the same way trio does?
finally: finally:
log.info(f"Actor {actor.uid} terminated") log.info(f"Subactor {actor.uid} terminated")
def _trio_main( def _trio_main(
@ -125,9 +126,11 @@ def _trio_main(
f' loglevel: {actor.loglevel}\n' f' loglevel: {actor.loglevel}\n'
) )
log.info( log.info(
'Started new trio process:\n' 'Started new trio subactor:\n'
+ +
actor_info '>\n' # like a "started/play"-icon from super perspective
+
actor_info,
) )
try: try:
@ -148,5 +151,7 @@ def _trio_main(
log.info( log.info(
'Subactor terminated\n' 'Subactor terminated\n'
+ +
'x\n' # like a "crossed-out/killed" from super perspective
+
actor_info actor_info
) )