mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-19 12:04:18 +02:00
Add setting to disable logging configuration (#1575)
This commit is contained in:
parent
74ce25726a
commit
587e37f059
2 changed files with 7 additions and 6 deletions
|
|
@ -6,11 +6,11 @@ from fastmcp.settings import Settings
|
|||
from fastmcp.utilities.logging import configure_logging as _configure_logging
|
||||
|
||||
settings = Settings()
|
||||
# if False:
|
||||
_configure_logging(
|
||||
level=settings.log_level,
|
||||
enable_rich_tracebacks=settings.enable_rich_tracebacks,
|
||||
)
|
||||
if settings.log_enabled:
|
||||
_configure_logging(
|
||||
level=settings.log_level,
|
||||
enable_rich_tracebacks=settings.enable_rich_tracebacks,
|
||||
)
|
||||
|
||||
from fastmcp.server.server import FastMCP
|
||||
from fastmcp.server.context import Context
|
||||
|
|
|
|||
|
|
@ -146,6 +146,7 @@ class Settings(BaseSettings):
|
|||
|
||||
test_mode: bool = False
|
||||
|
||||
log_enabled: bool = True
|
||||
log_level: LOG_LEVEL = "INFO"
|
||||
|
||||
@field_validator("log_level", mode="before")
|
||||
|
|
@ -314,7 +315,7 @@ class Settings(BaseSettings):
|
|||
Whether to include FastMCP meta in the server's MCP responses.
|
||||
If True, a `_fastmcp` key will be added to the `meta` field of
|
||||
all MCP component responses. This key will contain a dict of
|
||||
various FastMCP-specific metadata, such as tags.
|
||||
various FastMCP-specific metadata, such as tags.
|
||||
"""
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue