File size: 967 Bytes
475b0b9 a506b86 475b0b9 |
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 35 |
import logging
import logging.config
from logging.handlers import RotatingFileHandler
from tts_config import config
logging_config = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"simple": {"format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s"},
},
"handlers": {
"stdout": {
"class": "logging.StreamHandler",
"formatter": "simple",
"stream": "ext://sys.stdout",
},
"file": {
"class": "logging.handlers.RotatingFileHandler",
"formatter": "simple",
"filename": "dhwani_api.log",
"maxBytes": 10 * 1024 * 1024, # 10MB
"backupCount": 5,
},
},
"loggers": {
"root": {
"level": config.log_level.upper(),
"handlers": ["stdout", "file"],
},
},
}
logging.config.dictConfig(logging_config)
logger = logging.getLogger("indic_all_server") |