forked from goodboy/tractor
1
0
Fork 0

Only adjust logging in debug mode if not noisy enough already

agpl
Tyler Goodlet 2021-11-17 14:45:24 -05:00
parent e899cc42bf
commit 9bd5226e76
1 changed files with 11 additions and 1 deletions

View File

@ -4,6 +4,7 @@ Root actor runtime ignition(s).
from contextlib import asynccontextmanager
from functools import partial
import importlib
import logging
import os
from typing import Tuple, Optional, List, Any
import typing
@ -87,8 +88,17 @@ async def open_root_actor(
# for use of ``await tractor.breakpoint()``
enable_modules.append('tractor._debug')
# if debug mode get's enabled *at least* use that level of
# logging for some informative console prompts.
if loglevel is None:
loglevel = 'pdb'
if (
logging.getLevelName(
# lul, need the upper case for the -> int map?
# sweet "dynamic function behaviour" stdlib...
log.get_loglevel().upper()
) > logging.getLevelName('PDB')
):
loglevel = 'PDB'
elif debug_mode:
raise RuntimeError(