Fixed pre-commit problems, fixed small bug in logging_config to handle LOG_LEVEL env var
b1f4f7a
"""Logging configuration settings""" | |
import os | |
import sys | |
from logging.config import dictConfig | |
from typing import Any, Dict | |
DEFAULT_LOGGING_CONFIG: Dict[str, Any] = { | |
"version": 1, | |
"formatters": { | |
"simple": { | |
"format": "[%(asctime)s] [%(levelname)s] [%(name)s.%(funcName)s:%(lineno)d] [PID:%(process)d] %(message)s", | |
}, | |
}, | |
"filters": {}, | |
"handlers": { | |
"console": { | |
"class": "logging.StreamHandler", | |
"formatter": "simple", | |
"filters": [], | |
"stream": sys.stdout, | |
}, | |
}, | |
"root": {"handlers": ["console"], "level": os.getenv("LOG_LEVEL", "INFO")}, | |
} | |
def configure_logging(): | |
"""Configure with default logging""" | |
dictConfig(DEFAULT_LOGGING_CONFIG) | |