mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-21 13:04:18 +02:00
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:
parent
6a13ab98ad
commit
4e4436687b
1 changed files with 4 additions and 1 deletions
|
|
@ -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)],
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue