From 7c195841cd5c2494587054695b487b249279c946 Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Mon, 29 May 2023 15:45:45 +0200 Subject: [PATCH] print success after fail --- src/main.py | 6 ++++++ 1 file changed, 6 insertions(+) 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)