17 lines
465 B
Python
17 lines
465 B
Python
from __future__ import annotations
|
|
|
|
import logging
|
|
from typing import Union
|
|
|
|
|
|
def configure_logging(level: Union[str, int]) -> None:
|
|
numeric_level = level
|
|
if isinstance(level, str):
|
|
numeric_level = logging.getLevelName(level.upper())
|
|
if isinstance(numeric_level, str):
|
|
numeric_level = logging.INFO
|
|
logging.basicConfig(
|
|
level=numeric_level,
|
|
format="[%(asctime)s] [%(levelname)s] [%(name)s] %(message)s",
|
|
)
|