22 lines
683 B
Python
22 lines
683 B
Python
import logging
|
|
|
|
import werkzeug
|
|
from rich.logging import RichHandler
|
|
|
|
|
|
class Log:
|
|
@classmethod
|
|
def setup(cls) -> None:
|
|
handler = RichHandler(level=logging.DEBUG, rich_tracebacks=True)
|
|
logging.basicConfig(
|
|
level=logging.DEBUG,
|
|
format="%(message)s",
|
|
datefmt="[%Y-%m-%d %H:%M:%S]",
|
|
handlers=[handler],
|
|
)
|
|
|
|
# NOTE: pyright's reportPrivateUsage is suppressed here.
|
|
# We disable ANSI terminal codes from being added to Werkzeug (Flask) logs;
|
|
# RichHandler already handles all the fancy color stuff.
|
|
werkzeug.serving._log_add_style = False # pyright: ignore[reportPrivateUsage]
|