parent
b38324770b
commit
3972c6e915
@ -1,6 +1,16 @@
|
|||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
|
from loguru import logger
|
||||||
|
from starlette.requests import Request
|
||||||
|
|
||||||
from app.api import api as api_router
|
from app.api import api as api_router
|
||||||
|
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
app.include_router(api_router, prefix='/api')
|
app.include_router(api_router, prefix='/api')
|
||||||
|
|
||||||
|
|
||||||
|
@app.exception_handler(Exception)
|
||||||
|
async def log_exceptions(req: Request, err: Exception):
|
||||||
|
try:
|
||||||
|
raise err
|
||||||
|
except:
|
||||||
|
logger.exception(err)
|
||||||
|
|||||||
Loading…
Reference in New Issue