Tags
Here's my thought on 💭 logs with FastAPI and Uvicorn · Issue #1508 · tiangolo/fastapi
Setting an additional log handler to the uvicorn logger for access logs in fastapi was not straightforward, but This post was very helpful.
@app.on_event("startup")
async def startup_event():
logger = logging.getLogger("uvicorn.access")
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter("%(asctime)s - %(levelname)s - %(message)s"))
logger.addHandler(handler)
!!! note This post is a thought. It's a short note that I make about someone else's content online. Learn more about the process [[ thoughts ]]
{.text-opacity-80} This post was a thought by Waylon Walker see all my thoughts at https://waylonwalker.com/thoughts