Add timed logging for the webapp build #771

Merged
telackey merged 7 commits from telackey/logtime into main 2024-02-28 00:38:13 +00:00
Showing only changes of commit bf6d27ae63 - Show all commits

View File

@ -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()