From a4319957c740f9531349c8de549badfbcfd42b3c Mon Sep 17 00:00:00 2001 From: Matteo Ferrando Date: Tue, 17 Sep 2024 20:42:10 -0400 Subject: [PATCH] fix: reflect logger changes during life time of task (#155) --- src/isolate/server/server.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/isolate/server/server.py b/src/isolate/server/server.py index 12f2fb8..054567f 100644 --- a/src/isolate/server/server.py +++ b/src/isolate/server/server.py @@ -211,7 +211,7 @@ def _run_task(self, task: RunTask) -> Iterator[definitions.PartialRunResult]: StatusCode.INVALID_ARGUMENT, ) - log_handler = LogHandler(messages, logger=task.logger) + log_handler = LogHandler(messages, task=task) run_settings = replace( self.default_settings, @@ -480,10 +480,11 @@ def _proxy_to_queue( @dataclass class LogHandler: messages: Queue - logger: IsolateLogger = ENV_LOGGER + # Reference to the task so we can change the logger + task: RunTask def handle(self, log: Log) -> None: - self.logger.log(log.level, log.message, source=log.source) + self.task.logger.log(log.level, log.message, source=log.source) self._add_log_to_queue(log) def _add_log_to_queue(self, log: Log) -> None: