From eab895864fb241e1cd3308f1170e00e4d8c07cbe Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 1 Jul 2022 14:37:16 -0400 Subject: [PATCH] Always enable debug level logging if mode enabled --- tractor/_root.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/tractor/_root.py b/tractor/_root.py index 797e736..6ad84f1 100644 --- a/tractor/_root.py +++ b/tractor/_root.py @@ -103,13 +103,6 @@ async def open_root_actor( _default_arbiter_port, ) - if loglevel is None: - loglevel = log.get_loglevel() - else: - log._default_loglevel = loglevel - log.get_console_log(loglevel) - - assert loglevel if debug_mode and _spawn._spawn_method == 'trio': _state._runtime_vars['_debug_mode'] = True @@ -124,7 +117,7 @@ async def open_root_actor( logging.getLevelName( # lul, need the upper case for the -> int map? # sweet "dynamic function behaviour" stdlib... - loglevel.upper() + loglevel.upper() if loglevel else loglevel, ) > logging.getLevelName('PDB') ): loglevel = 'PDB' @@ -134,6 +127,10 @@ async def open_root_actor( "Debug mode is only supported for the `trio` backend!" ) + loglevel = log._default_loglevel = loglevel.upper() + assert loglevel + log.get_console_log(loglevel) + # make a temporary connection to see if an arbiter exists arbiter_found = False