celery,logger,limiter,cache,logo

This commit is contained in:
resonate
2022-01-24 11:58:28 +08:00
parent a3c61d3291
commit 2e6067fd31
15 changed files with 127 additions and 27 deletions
+55
View File
@@ -0,0 +1,55 @@
from logging.config import dictConfig
def config_logger():
dictConfig(
{
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"simple": {"format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s"}
},
"handlers": {
"console": {
"class": "logging.StreamHandler",
"level": "DEBUG",
"formatter": "simple",
"stream": "ext://sys.stdout",
},
"info_file_handler": {
"class": "logging.handlers.RotatingFileHandler",
"level": "INFO",
"formatter": "simple",
"filename": "logs/info.log",
"maxBytes": 10485760,
"backupCount": 50,
"encoding": "utf8",
},
"error_file_handler": {
"class": "logging.handlers.RotatingFileHandler",
"level": "ERROR",
"formatter": "simple",
"filename": "logs/errors.log",
"maxBytes": 10485760,
"backupCount": 20,
"encoding": "utf8",
},
"debug_file_handler": {
"class": "logging.handlers.RotatingFileHandler",
"level": "DEBUG",
"formatter": "simple",
"filename": "logs/debug.log",
"maxBytes": 10485760,
"backupCount": 50,
"encoding": "utf8",
},
},
"loggers": {
"my_module": {"level": "ERROR", "handlers": ["console"], "propagate": "no"}
},
"root": {
"level": "DEBUG",
"handlers": ["error_file_handler", "debug_file_handler"],
},
}
)