-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhelpers.py
More file actions
20 lines (17 loc) · 661 Bytes
/
Copy pathhelpers.py
File metadata and controls
20 lines (17 loc) · 661 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from __future__ import annotations
import logging
from collections.abc import MutableMapping
from logging import Logger
def get_logger(name: str, config: MutableMapping = None) -> Logger:
"""Obtaints a logger instance of the given name, optionally configured to
have an output level of debug via toml config [main][verbose]
Returns the logger instance"""
logging.basicConfig(
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
)
logger = logging.getLogger(name)
if config and "verbose" in config["main"]:
logger.setLevel(logging.DEBUG)
else:
logger.setLevel(logging.INFO)
return logger