diff --git a/src/main.py b/src/main.py index 9237afe..0b276aa 100644 --- a/src/main.py +++ b/src/main.py @@ -1,11 +1,18 @@ -"""Main entry point for the RAGAnything API.""" - +import asyncio import logging -import logging.config +import sys from contextlib import asynccontextmanager from pathlib import Path import uvicorn + +logging.basicConfig( + level=logging.INFO, + format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", + stream=sys.stdout, + force=True, +) + from alembic.config import Config from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware @@ -22,41 +29,8 @@ from application.api.query_routes import query_router from dependencies import app_config, bm25_adapter, classical_vector_store -_LOG_FORMAT = "%(asctime)s %(levelname)-8s [%(name)s] %(message)s" - -LOG_CONFIG = { - "version": 1, - "disable_existing_loggers": False, - "formatters": { - "standard": {"format": _LOG_FORMAT}, - }, - "handlers": { - "console": { - "class": "logging.StreamHandler", - "formatter": "standard", - "stream": "ext://sys.stderr", - }, - }, - "loggers": { - "uvicorn": {"handlers": ["console"], "level": "INFO", "propagate": False}, - "uvicorn.error": {"handlers": ["console"], "level": "INFO", "propagate": False}, - "uvicorn.access": { - "handlers": ["console"], - "level": "INFO", - "propagate": False, - }, - }, - "root": { - "level": "INFO", - "handlers": ["console"], - }, -} - -logging.config.dictConfig(LOG_CONFIG) - logger = logging.getLogger(__name__) - def _run_alembic_upgrade() -> None: """Run Alembic migrations to head.""" alembic_dir = Path(__file__).parent @@ -138,7 +112,7 @@ def run_fastapi(): host=app_config.HOST, port=app_config.PORT, log_level=app_config.UVICORN_LOG_LEVEL, - log_config=LOG_CONFIG, + log_config=None, access_log=True, ws="none", )