Update buncha log msg fmting in `.msg._ops`
Mostly just multi-line code styling again: always putting standalone `'f\n'` on separate LOC so it reads like it renders to console. Oh and and a level drop to `.runtime()` for rx-msg reports.enable_tpts
parent
d50f7ba9ca
commit
76fb80fda6
|
@ -210,12 +210,14 @@ class PldRx(Struct):
|
||||||
match msg:
|
match msg:
|
||||||
case Return()|Error():
|
case Return()|Error():
|
||||||
log.runtime(
|
log.runtime(
|
||||||
f'Rxed final outcome msg\n'
|
f'Rxed final-outcome msg\n'
|
||||||
|
f'\n'
|
||||||
f'{msg}\n'
|
f'{msg}\n'
|
||||||
)
|
)
|
||||||
case Stop():
|
case Stop():
|
||||||
log.runtime(
|
log.runtime(
|
||||||
f'Rxed stream stopped msg\n'
|
f'Rxed stream stopped msg\n'
|
||||||
|
f'\n'
|
||||||
f'{msg}\n'
|
f'{msg}\n'
|
||||||
)
|
)
|
||||||
if passthrough_non_pld_msgs:
|
if passthrough_non_pld_msgs:
|
||||||
|
@ -261,8 +263,9 @@ class PldRx(Struct):
|
||||||
if (
|
if (
|
||||||
type(msg) is Return
|
type(msg) is Return
|
||||||
):
|
):
|
||||||
log.info(
|
log.runtime(
|
||||||
f'Rxed final result msg\n'
|
f'Rxed final result msg\n'
|
||||||
|
f'\n'
|
||||||
f'{msg}\n'
|
f'{msg}\n'
|
||||||
)
|
)
|
||||||
return self.decode_pld(
|
return self.decode_pld(
|
||||||
|
@ -304,10 +307,13 @@ class PldRx(Struct):
|
||||||
try:
|
try:
|
||||||
pld: PayloadT = self._pld_dec.decode(pld)
|
pld: PayloadT = self._pld_dec.decode(pld)
|
||||||
log.runtime(
|
log.runtime(
|
||||||
'Decoded msg payload\n\n'
|
f'Decoded payload for\n'
|
||||||
|
# f'\n'
|
||||||
f'{msg}\n'
|
f'{msg}\n'
|
||||||
f'where payload decoded as\n'
|
# ^TODO?, ideally just render with `,
|
||||||
f'|_pld={pld!r}\n'
|
# pld={decode}` in the `msg.pformat()`??
|
||||||
|
f'where, '
|
||||||
|
f'{type(msg).__name__}.pld={pld!r}\n'
|
||||||
)
|
)
|
||||||
return pld
|
return pld
|
||||||
except TypeError as typerr:
|
except TypeError as typerr:
|
||||||
|
@ -494,7 +500,8 @@ def limit_plds(
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
log.runtime(
|
log.runtime(
|
||||||
'Reverted to previous payload-decoder\n\n'
|
f'Reverted to previous payload-decoder\n'
|
||||||
|
f'\n'
|
||||||
f'{orig_pldec}\n'
|
f'{orig_pldec}\n'
|
||||||
)
|
)
|
||||||
# sanity on orig settings
|
# sanity on orig settings
|
||||||
|
@ -629,7 +636,8 @@ async def drain_to_final_msg(
|
||||||
(local_cs := rent_n.cancel_scope).cancel_called
|
(local_cs := rent_n.cancel_scope).cancel_called
|
||||||
):
|
):
|
||||||
log.cancel(
|
log.cancel(
|
||||||
'RPC-ctx cancelled by local-parent scope during drain!\n\n'
|
f'RPC-ctx cancelled by local-parent scope during drain!\n'
|
||||||
|
f'\n'
|
||||||
f'c}}>\n'
|
f'c}}>\n'
|
||||||
f' |_{rent_n}\n'
|
f' |_{rent_n}\n'
|
||||||
f' |_.cancel_scope = {local_cs}\n'
|
f' |_.cancel_scope = {local_cs}\n'
|
||||||
|
@ -663,7 +671,8 @@ async def drain_to_final_msg(
|
||||||
# final result arrived!
|
# final result arrived!
|
||||||
case Return():
|
case Return():
|
||||||
log.runtime(
|
log.runtime(
|
||||||
'Context delivered final draining msg:\n'
|
f'Context delivered final draining msg\n'
|
||||||
|
f'\n'
|
||||||
f'{pretty_struct.pformat(msg)}'
|
f'{pretty_struct.pformat(msg)}'
|
||||||
)
|
)
|
||||||
ctx._result: Any = pld
|
ctx._result: Any = pld
|
||||||
|
@ -697,12 +706,14 @@ async def drain_to_final_msg(
|
||||||
):
|
):
|
||||||
log.cancel(
|
log.cancel(
|
||||||
'Cancelling `MsgStream` drain since '
|
'Cancelling `MsgStream` drain since '
|
||||||
f'{reason}\n\n'
|
f'{reason}\n'
|
||||||
|
f'\n'
|
||||||
f'<= {ctx.chan.uid}\n'
|
f'<= {ctx.chan.uid}\n'
|
||||||
f' |_{ctx._nsf}()\n\n'
|
f' |_{ctx._nsf}()\n'
|
||||||
|
f'\n'
|
||||||
f'=> {ctx._task}\n'
|
f'=> {ctx._task}\n'
|
||||||
f' |_{ctx._stream}\n\n'
|
f' |_{ctx._stream}\n'
|
||||||
|
f'\n'
|
||||||
f'{pretty_struct.pformat(msg)}\n'
|
f'{pretty_struct.pformat(msg)}\n'
|
||||||
)
|
)
|
||||||
break
|
break
|
||||||
|
@ -739,7 +750,8 @@ async def drain_to_final_msg(
|
||||||
case Stop():
|
case Stop():
|
||||||
pre_result_drained.append(msg)
|
pre_result_drained.append(msg)
|
||||||
log.runtime( # normal/expected shutdown transaction
|
log.runtime( # normal/expected shutdown transaction
|
||||||
'Remote stream terminated due to "stop" msg:\n\n'
|
f'Remote stream terminated due to "stop" msg\n'
|
||||||
|
f'\n'
|
||||||
f'{pretty_struct.pformat(msg)}\n'
|
f'{pretty_struct.pformat(msg)}\n'
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
@ -814,7 +826,8 @@ async def drain_to_final_msg(
|
||||||
|
|
||||||
else:
|
else:
|
||||||
log.cancel(
|
log.cancel(
|
||||||
'Skipping `MsgStream` drain since final outcome is set\n\n'
|
f'Skipping `MsgStream` drain since final outcome is set\n'
|
||||||
|
f'\n'
|
||||||
f'{ctx.outcome}\n'
|
f'{ctx.outcome}\n'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue