From 443ebea165fd7af1f22174b214a3049806a181a1 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 8 Jul 2021 13:02:33 -0400 Subject: [PATCH] Use "pdb" level logging in debug mode --- tractor/_debug.py | 4 ++-- tractor/_root.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tractor/_debug.py b/tractor/_debug.py index c1b1832..c76422a 100644 --- a/tractor/_debug.py +++ b/tractor/_debug.py @@ -276,7 +276,7 @@ def _set_trace(actor=None): pdb = _mk_pdb() if actor is not None: - log.runtime(f"\nAttaching pdb to actor: {actor.uid}\n") + log.pdb(f"\nAttaching pdb to actor: {actor.uid}\n") pdb.set_trace( # start 2 levels up in user code @@ -306,7 +306,7 @@ breakpoint = partial( def _post_mortem(actor): - log.runtime(f"\nAttaching to pdb in crashed actor: {actor.uid}\n") + log.pdb(f"\nAttaching to pdb in crashed actor: {actor.uid}\n") pdb = _mk_pdb() # custom Pdb post-mortem entry diff --git a/tractor/_root.py b/tractor/_root.py index da4ba68..8391f4c 100644 --- a/tractor/_root.py +++ b/tractor/_root.py @@ -86,6 +86,9 @@ async def open_root_actor( # for use of ``await tractor.breakpoint()`` enable_modules.append('tractor._debug') + if loglevel is None: + loglevel = 'pdb' + elif debug_mode: raise RuntimeError( "Debug mode is only supported for the `trio` backend!"