From c7fcfc7443a4a6b399c25070619a73c696139e5d Mon Sep 17 00:00:00 2001 From: aaron <> Date: Sat, 15 Feb 2025 14:55:52 +0800 Subject: [PATCH] update --- app/main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/main.py b/app/main.py index f3f5995..384afa6 100644 --- a/app/main.py +++ b/app/main.py @@ -8,6 +8,7 @@ from app.core.response import error_response from fastapi import HTTPException from app.middleware.request_logger import RequestLoggerMiddleware from app.core.response import CustomJSONResponse +import logging # 创建数据库表 Base.metadata.create_all(bind=engine) @@ -66,6 +67,7 @@ async def health_check(): @app.exception_handler(RequestValidationError) async def validation_exception_handler(request, exc): + logging.exception(f"请求参数错误: {str(exc)}") return CustomJSONResponse( status_code=400, content=error_response( @@ -76,6 +78,7 @@ async def validation_exception_handler(request, exc): @app.exception_handler(HTTPException) async def http_exception_handler(request, exc): + logging.exception(f"HTTP异常: {str(exc)}") return CustomJSONResponse( status_code=exc.status_code, content=error_response(