Add timed logging for the webapp build #771
@ -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()
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user