diff --git a/src/main.py b/src/main.py index 1cb8798..1690dff 100644 --- a/src/main.py +++ b/src/main.py @@ -31,12 +31,18 @@ def reachable(domain: str) -> tuple[bool, str]: return False, e.__str__() def monitor(): + last_was_fail: bool = False while True: try: b, msg = check_net() if not b: print(f":FAILURE AT {datetime.now()}:") print(msg) + last_was_fail = True + elif b and last_was_fail: + print(f":SUCCESS AT {datetime.now()}:") + print(msg) + last_was_fail = False sleep(SLEEPTIME) except Exception as e: print(e)