fix: use stderr for logging

Without this, logs get sent to stdout which is captured by the
JSONRPC protocol (which also causes some errors with clients when
the invalid JSON is sent over the stdout pipe).
This commit is contained in:
Ben Sully 2024-12-03 16:19:29 +00:00
commit 4e4436687b
No known key found for this signature in database

View file

@ -3,6 +3,7 @@
import logging
from typing import Literal
from rich.console import Console
from rich.logging import RichHandler
@ -27,5 +28,7 @@ def configure_logging(
level: the log level to use
"""
logging.basicConfig(
level=level, format="%(message)s", handlers=[RichHandler(rich_tracebacks=True)]
level=level,
format="%(message)s",
handlers=[RichHandler(console=Console(stderr=True), rich_tracebacks=True)],
)