monitor: properly initialize timer_start

It is set in `module()` which must be called before `result` so the
actual usage was fine, but it was not initialized in `__init__`.
This commit is contained in:
Christian Kellner 2022-05-06 15:08:52 +02:00 committed by Achilleas Koutsou
parent d04ce2e1ef
commit 1bcbf3a2d2

View file

@ -91,6 +91,11 @@ class LogMonitor(BaseMonitor):
the log will get written to. If `fd` is a `TTY`, escape
sequences will be used to highlight sections of the log.
"""
def __init__(self, fd: int):
super().__init__(fd)
self.timer_start = 0
def result(self, result):
duration = int(time.time() - self.timer_start)
self.out.write(f"\n⏱ Duration: {duration}s\n")