File size: 570 Bytes
6494c95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""Logging setup shared by the app and the scripts.

Libraries that log request URLs (httpx, httpcore, huggingface_hub) are kept at WARNING so provider
and CDN URLs never reach the logs. Our own loggers stay at INFO.
"""

from __future__ import annotations

import logging

QUIET_LOGGERS = ("httpx", "httpcore", "huggingface_hub")


def configure_logging(fmt: str = "%(asctime)s %(levelname)s %(name)s %(message)s") -> None:
    logging.basicConfig(level=logging.INFO, format=fmt)
    for name in QUIET_LOGGERS:
        logging.getLogger(name).setLevel(logging.WARNING)