Add startup warnings for missing tool secrets to provide faster feedback on configuration issues. --- Linear Issue: [TOO-198](https://linear.app/arcadedev/issue/TOO-198/add-startup-warnings-for-missing-tool-secrets) <a href="https://cursor.com/background-agent?bcId=bc-203d1b6a-80a7-4933-b3ff-b3a9220b5809"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/open-in-cursor-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/open-in-cursor-light.svg"><img alt="Open in Cursor" src="https://cursor.com/open-in-cursor.svg"></picture></a> <a href="https://cursor.com/agents?id=bc-203d1b6a-80a7-4933-b3ff-b3a9220b5809"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/open-in-web-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/open-in-web-light.svg"><img alt="Open in Web" src="https://cursor.com/open-in-web.svg"></picture></a> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Eric Gustin <eric@arcade.dev>
30 lines
946 B
Python
30 lines
946 B
Python
"""Shared logging utilities for MCP server."""
|
|
|
|
import logging
|
|
|
|
from loguru import logger
|
|
|
|
|
|
class LoguruInterceptHandler(logging.Handler):
|
|
"""Intercept standard logging and route to Loguru.
|
|
|
|
This handler bridges the standard Python logging module with Loguru,
|
|
ensuring all logs (from both systems) use the same formatting.
|
|
"""
|
|
|
|
def emit(self, record: logging.LogRecord) -> None:
|
|
try:
|
|
level = logger.level(record.levelname).name
|
|
except ValueError:
|
|
level = str(record.levelno)
|
|
|
|
logger.opt(exception=record.exc_info).log(level, record.getMessage())
|
|
|
|
|
|
def intercept_standard_logging() -> None:
|
|
"""Configure standard logging to route through Loguru.
|
|
|
|
This should be called after Loguru is configured to ensure all
|
|
standard logging calls are intercepted and formatted consistently.
|
|
"""
|
|
logging.basicConfig(handlers=[LoguruInterceptHandler()], level=0, force=True)
|