Skip to content

Instantly share code, notes, and snippets.

@mrthere3
mrthere3 / logger.py
Created May 13, 2024 12:00 — forked from dishwad/logger.py
Logging configuration for FastAPI using Gunicorn + Uvicorn workers
import logging
import sys
import time
from typing import Callable
from fastapi import Request, Response
from fastapi.routing import APIRoute
from gunicorn.glogging import Logger
from loguru import logger
from starlette.background import BackgroundTask