Skip to content

Commit

Permalink
fix(logger): fix too noisy logger (#300)
Browse files Browse the repository at this point in the history
  • Loading branch information
34j committed Apr 12, 2023
1 parent 11f2d24 commit bd0eb33
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/so_vits_svc_fork/logger.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import os
import sys
from logging import (
DEBUG,
INFO,
FileHandler,
StreamHandler,
basicConfig,
captureWarnings,
getLogger,
)
from pathlib import Path

Expand All @@ -23,13 +25,15 @@ 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=[
RichHandler() if not IN_COLAB else StreamHandler(),
FileHandler(f"{__name__.split('.')[0]}.log"),
],
)
if IS_TEST:
getLogger(sys.modules[__name__].__package__).setLevel(DEBUG)
captureWarnings(True)
LOGGER_INIT = True

0 comments on commit bd0eb33

Please sign in to comment.