1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-10 22:36:55 +08:00

Fix logging_level: make logging level specified in qlib.init applies to all loggers (#1368)

* fix logging_level: make logging level specified in qlib.init apply to all loggers

* downgrade loglevel in expmanager __init__ to debug (it will be called in each process in multiprocessing operations such as read data)

* correct gramma error

* fix black lint

* use functor to cache loggers and set level

* correct black lint

* correct pylint

* correct pylint
This commit is contained in:
YQ Tsui
2022-11-29 08:09:22 +08:00
committed by GitHub
parent 4f5ae4d224
commit 6a47416a2d
7 changed files with 42 additions and 34 deletions

View File

@@ -10,7 +10,7 @@ import yaml
import logging
import platform
import subprocess
from .log import get_module_logger
from .log import get_module_logger, set_global_logger_level
# init qlib
@@ -34,8 +34,7 @@ def init(default_conf="client", **kwargs):
from .config import C # pylint: disable=C0415
from .data.cache import H # pylint: disable=C0415
# FIXME: this logger ignored the level in config
logger = get_module_logger("Initialization", level=logging.INFO)
logger = get_module_logger("Initialization")
skip_if_reg = kwargs.pop("skip_if_reg", False)
if skip_if_reg and C.registered:
@@ -48,6 +47,7 @@ def init(default_conf="client", **kwargs):
if clear_mem_cache:
H.clear()
C.set(default_conf, **kwargs)
get_module_logger.setLevel(C.logging_level)
# mount nfs
for _freq, provider_uri in C.provider_uri.items():