diff --git a/stack_orchestrator/deploy/webapp/util.py b/stack_orchestrator/deploy/webapp/util.py index 4fdcfe4e..9b7427c0 100644 --- a/stack_orchestrator/deploy/webapp/util.py +++ b/stack_orchestrator/deploy/webapp/util.py @@ -48,14 +48,14 @@ class TimedLogger: self.file = file def log(self, msg, show_step_time=True, show_total_time=False): - prefix = f"{datetime.datetime.utcnow()}" + prefix = f"{datetime.datetime.utcnow()} - {self.id}" if show_step_time: prefix += f" - {datetime.datetime.now() - self.last} (step)" - if show_step_time: + if show_total_time: prefix += f" - {datetime.datetime.now() - self.start} (total)" - prefix += f" - {self.id}" - print(f"{prefix}: {msg}", file=self.file) + if self.file: + self.file.flush() self.last = datetime.datetime.now()