From b931d5281a7625165a10021f6c940595e957ee1c Mon Sep 17 00:00:00 2001 From: BeatrixCohere <128378696+BeatrixCohere@users.noreply.github.com> Date: Wed, 7 Aug 2024 11:16:40 +0100 Subject: [PATCH] log --- src/backend/main.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/backend/main.py b/src/backend/main.py index b7d3752f00..717e3f93dd 100644 --- a/src/backend/main.py +++ b/src/backend/main.py @@ -27,6 +27,7 @@ from backend.services.context import ContextMiddleware, get_context from backend.services.logger.middleware import LoggingMiddleware from backend.services.metrics import MetricsMiddleware +from structlog import get_logger load_dotenv() @@ -128,7 +129,7 @@ async def health(): @app.post("/migrate") -async def apply_migrations(request: Request): +async def apply_migrations(): """ Applies Alembic migrations - useful for serverless applications """ @@ -136,15 +137,11 @@ async def apply_migrations(request: Request): alembic_cfg = Config("src/backend/alembic.ini") upgrade(alembic_cfg, "head") except Exception as e: - ctx = get_context(request) - logger = ctx.get_logger() + logger = get_logger() logger.exception( event="Error while applying Alembic migrations", error=str(e), - method=request.method, - url=request.url, - ctx=ctx, ) raise HTTPException( status_code=500, detail=f"Error while applying Alembic migrations: {str(e)}"