forked from goodboy/tractor
`get_loglevel()` always returns a str
parent
72eef2a4a1
commit
92c6ec1882
|
@ -87,11 +87,15 @@ async def open_root_actor(
|
||||||
_default_arbiter_port,
|
_default_arbiter_port,
|
||||||
)
|
)
|
||||||
|
|
||||||
loglevel = loglevel or log.get_loglevel()
|
|
||||||
if loglevel is not None:
|
if loglevel is None:
|
||||||
|
loglevel = log.get_loglevel()
|
||||||
|
else:
|
||||||
log._default_loglevel = loglevel
|
log._default_loglevel = loglevel
|
||||||
log.get_console_log(loglevel)
|
log.get_console_log(loglevel)
|
||||||
|
|
||||||
|
assert loglevel
|
||||||
|
|
||||||
if debug_mode and _spawn._spawn_method == 'trio':
|
if debug_mode and _spawn._spawn_method == 'trio':
|
||||||
_state._runtime_vars['_debug_mode'] = True
|
_state._runtime_vars['_debug_mode'] = True
|
||||||
|
|
||||||
|
@ -105,7 +109,7 @@ async def open_root_actor(
|
||||||
logging.getLevelName(
|
logging.getLevelName(
|
||||||
# lul, need the upper case for the -> int map?
|
# lul, need the upper case for the -> int map?
|
||||||
# sweet "dynamic function behaviour" stdlib...
|
# sweet "dynamic function behaviour" stdlib...
|
||||||
log.get_loglevel().upper()
|
loglevel.upper()
|
||||||
) > logging.getLevelName('PDB')
|
) > logging.getLevelName('PDB')
|
||||||
):
|
):
|
||||||
loglevel = 'PDB'
|
loglevel = 'PDB'
|
||||||
|
|
|
@ -9,8 +9,8 @@ from typing import Optional
|
||||||
from ._state import ActorContextInfo
|
from ._state import ActorContextInfo
|
||||||
|
|
||||||
|
|
||||||
_proj_name = 'tractor'
|
_proj_name: str = 'tractor'
|
||||||
_default_loglevel = 'ERROR'
|
_default_loglevel: str = 'ERROR'
|
||||||
|
|
||||||
# Super sexy formatting thanks to ``colorlog``.
|
# Super sexy formatting thanks to ``colorlog``.
|
||||||
# (NOTE: we use the '{' format style)
|
# (NOTE: we use the '{' format style)
|
||||||
|
@ -189,5 +189,5 @@ def get_console_log(
|
||||||
return log
|
return log
|
||||||
|
|
||||||
|
|
||||||
def get_loglevel() -> Optional[str]:
|
def get_loglevel() -> str:
|
||||||
return _default_loglevel
|
return _default_loglevel
|
||||||
|
|
Loading…
Reference in New Issue