Spaces:
Runtime error
Runtime error
| """Logging configuration for the application.""" | |
| import logging | |
| import sys | |
| from app.utils.config import LOG_LEVEL | |
| def setup_logging() -> None: | |
| """Configure logging for the application.""" | |
| # Convert string log level to logging constant | |
| log_level = getattr(logging, LOG_LEVEL.upper(), logging.INFO) | |
| # Configure root logger | |
| logging.basicConfig( | |
| level=log_level, | |
| format="%(asctime)s %(levelname)s [%(filename)s:%(lineno)d] %(message)s", | |
| handlers=[logging.StreamHandler(sys.stdout)], | |
| ) | |
| # Suppress overly verbose logs from some libraries | |
| logging.getLogger("urllib3").setLevel(logging.WARNING) | |
| logging.getLogger("requests").setLevel(logging.WARNING) | |
| def get_logger(name: str) -> logging.Logger: | |
| """Get a logger with the specified name.""" | |
| return logging.getLogger(name) | |