diff --git a/src/so_vits_svc_fork/logger.py b/src/so_vits_svc_fork/logger.py index af105bf0..3d271db4 100644 --- a/src/so_vits_svc_fork/logger.py +++ b/src/so_vits_svc_fork/logger.py @@ -1,4 +1,5 @@ import os +import sys from logging import ( DEBUG, INFO, @@ -6,6 +7,7 @@ StreamHandler, basicConfig, captureWarnings, + getLogger, ) from pathlib import Path @@ -23,7 +25,7 @@ def init_logger() -> None: IS_TEST = "test" in Path.cwd().stem basicConfig( - level=DEBUG if IS_TEST else INFO, + level=INFO, format="%(asctime)s %(message)s", datefmt="[%X]", handlers=[ @@ -31,5 +33,7 @@ def init_logger() -> None: FileHandler(f"{__name__.split('.')[0]}.log"), ], ) + if IS_TEST: + getLogger(sys.modules[__name__].__package__).setLevel(DEBUG) captureWarnings(True) LOGGER_INIT = True