gradio_with_fastapi / routes.py
alessandro trinca tornidor
feat: change logger library to structlog
c7d60e1
raw
history blame
350 Bytes
import random
import structlog
from fastapi import APIRouter
from helpers import formatters
custom_structlog_logger = structlog.stdlib.get_logger(__name__)
router = APIRouter()
@router.get("/health")
def health():
n = random.randint(-1, 1)
custom_structlog_logger.info(f"random int:{n}")
return formatters.request_formatter(f"{n}")