Files
sac4cps-backend/monolith/src/core/logging_config.py
2025-12-20 00:51:04 +00:00

26 lines
733 B
Python

"""Logging configuration."""
import logging
import sys
from .config import settings
def setup_logging():
"""Configure application logging."""
log_level = logging.DEBUG if settings.debug else logging.INFO
logging.basicConfig(
level=log_level,
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
handlers=[
logging.StreamHandler(sys.stdout)
]
)
# Set third-party loggers to WARNING
logging.getLogger("uvicorn").setLevel(logging.WARNING)
logging.getLogger("motor").setLevel(logging.WARNING)
logging.getLogger("redis").setLevel(logging.WARNING)
logger = logging.getLogger(__name__)
logger.info(f"Logging configured. Level: {log_level}")