diff --git a/chain_service/app.py b/chain_service/app.py index 63aa448..5085b9a 100644 --- a/chain_service/app.py +++ b/chain_service/app.py @@ -1,13 +1,32 @@ -from chain_service.logging import setup_logging +import logging +import threading from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware + +from chain_service.logging import setup_logging from chain_service.controllers.__main__ import setup_controllers setup_logging() application = FastAPI() +logging.basicConfig(level=logging.DEBUG) + + +# Subclass threading.Thread for logging +class DebugThread(threading.Thread): + def __init__(self, *args, **kwargs): + logging.debug(f"Creating thread {args} {kwargs}") + super().__init__(*args, **kwargs) + + def _delete(self): + logging.debug(f"Deleting thread {self.name}") + super()._delete() + + +threading.Thread = DebugThread + application.add_middleware( CORSMiddleware, allow_origins=["http://localhost:5173"],