Coverage for src/otg_mcp/__main__.py: 0%

1 import logging

2 import sys

3 import traceback

4

5 from .server import run_server

6

7 logger = logging.getLogger(__name__)

8

9 logger.info("Setting logging level to INFO for all otg_mcp modules")

10 for name in logging.root.manager.loggerDict:

11 if name.startswith("otg_mcp"):

12 logging.getLogger(name).setLevel(logging.INFO)

13

14 if __name__ == "__main__":

15 try:

16 logger.info("Starting OTG MCP Server via __main__")

17

18 logger.info("Logging Python environment information")

19 logger.info(f"Python version: {sys.version}")

20 logger.info(f"Python executable: {sys.executable}")

21

22 logger.info("Starting OTG MCP server via run_server()")

23 run_server()

24 logger.info("Server execution completed normally")

25 sys.exit(0)

26 except ImportError as e:

27 error_message = f"IMPORT ERROR: Failed to import required module: {str(e)}"

28 logger.critical(error_message)

29 logger.critical(f"Traceback: {traceback.format_exc()}")

30 sys.exit(1)

31 except Exception as e:

32 error_message = f"CRITICAL ERROR: Server failed to start: {str(e)}"

33 logger.critical(error_message)

34 logger.critical(f"Traceback: {traceback.format_exc()}")

35 sys.exit(1)