File size: 881 Bytes
b1f4f7a
 
 
553a86b
 
 
 
 
 
 
 
9234b75
553a86b
 
 
 
 
 
 
 
 
 
 
b1f4f7a
d75adb9
 
 
553a86b
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""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")},
    "loggers": {
        "axolotl": {"handlers": ["console"], "level": "DEBUG", "propagate": False},
    },
}


def configure_logging():
    """Configure with default logging"""
    dictConfig(DEFAULT_LOGGING_CONFIG)