handbook-ocr-engine / app /core /logging.py
internationalscholarsprogram's picture
Initial deploy: ISP Handbook OCR Engine
b12284c verified
raw
history blame contribute delete
567 Bytes
"""Centralized logging configuration."""
from __future__ import annotations
import logging
import sys
def setup_logging(debug: bool = False) -> None:
level = logging.DEBUG if debug else logging.INFO
fmt = "%(asctime)s | %(levelname)-8s | %(name)s | %(message)s"
logging.basicConfig(
level=level,
format=fmt,
stream=sys.stdout,
force=True,
)
# Quiet noisy libraries
for name in ("httpx", "httpcore", "uvicorn.access", "PIL"):
logging.getLogger(name).setLevel(logging.WARNING)