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")