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)