Skip to content

Commit 2f2ef32

Browse files
committed
fix custom log level issue
1 parent 0a28ea5 commit 2f2ef32

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

autointent/_logging/config.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@ formatters:
1616
line: lineno
1717
thread_name: threadName
1818
handlers:
19-
stderr:
19+
stdout:
2020
class: logging.StreamHandler
21-
level: INFO
2221
formatter: json
2322
stream: ext://sys.stdout
2423
loggers:
2524
root:
26-
level: DEBUG
2725
handlers:
28-
- stderr
29-
- file
26+
- stdout

autointent/_logging/setup.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
import importlib.resources as ires
2-
import json
32
import logging.config
43
import logging.handlers
54

5+
import yaml
6+
67
from autointent.custom_types import LogLevel
78

89

9-
def setup_logging(level: LogLevel) -> None:
10-
config_file = ires.files("autointent._logging").joinpath("config.json")
10+
def setup_logging(level: LogLevel | str) -> None:
11+
config_file = ires.files("autointent._logging").joinpath("config.yaml")
1112
with config_file.open() as f_in:
12-
config = json.load(f_in)
13+
config = yaml.safe_load(f_in)
14+
15+
level = LogLevel(level)
16+
config["loggers"]["root"]["level"] = level.value
1317

1418
logging.config.dictConfig(config)
15-
logging.basicConfig(level=level.value)

0 commit comments

Comments
 (0)