This commit is contained in:
Leon
2025-07-15 22:54:35 +02:00
commit f7eda17284
89 changed files with 18535 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
import logging
from logging.config import dictConfig
"""Logging configuration for the application."""
def setup_logging():
"""Set up the logging configuration for the application."""
log_config = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"default": {
"()": "logging.Formatter",
"fmt": "%(asctime)s - %(name)s - %(levelname)s - %(message)s",
},
},
"handlers": {
"default": {
"formatter": "default",
"class": "logging.StreamHandler",
"stream": "ext://sys.stdout",
},
},
"loggers": {
"app": {
"handlers": ["default"],
"level": "INFO",
"propagate": True,
},
"uvicorn": {
"handlers": ["default"],
"level": "INFO",
"propagate": False,
},
"uvicorn.error": {
"level": "INFO",
},
"uvicorn.access": {
"handlers": ["default"],
"level": "INFO",
"propagate": False,
},
},
}
dictConfig(log_config)
def get_logger(name: str):
"""Return a logger instance with the given name."""
return logging.getLogger(name)