diff --git a/healthchain/decorators.py b/healthchain/decorators.py index 9376ae6..d1c59e2 100644 --- a/healthchain/decorators.py +++ b/healthchain/decorators.py @@ -1,4 +1,5 @@ import logging +import logging.config import threading import asyncio import json @@ -215,6 +216,7 @@ def start_sandbox( service_id: str = "1", save_data: bool = True, save_dir: str = "./output/", + logging_config: Optional[Dict] = None, ) -> None: """ Starts the sandbox: initialises service and sends a request through the client. @@ -229,6 +231,17 @@ def start_sandbox( self.sandbox_id = uuid.uuid4() + if logging_config: + logging.config.dictConfig(logging_config) + else: + # Set up default logging configuration + logging.basicConfig( + level=logging.INFO, + format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", + ) + + log = logging.getLogger(__name__) + # Start service on thread log.info( f"Starting sandbox {self.sandbox_id} with {self.__class__.__name__} of type {self.type.value}..."