From 2dcd14dc17f3e60329aa246dc41ace26615d8eb5 Mon Sep 17 00:00:00 2001 From: YandolsZX Date: Tue, 28 Mar 2023 21:17:44 +0800 Subject: [PATCH] Added print timestamp to console for when the monitor does something. --- chatterino_process_monitor.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/chatterino_process_monitor.py b/chatterino_process_monitor.py index fd03a27..26738f2 100644 --- a/chatterino_process_monitor.py +++ b/chatterino_process_monitor.py @@ -5,6 +5,7 @@ import os import subprocess import pystray from PIL import Image +from datetime import datetime # Function to check if Chatterino is running def is_chatterino_running(): @@ -19,7 +20,9 @@ def is_chatterino_running(): # Function to run Chatterino def run_program(program_path): subprocess.Popen([program_path], cwd=program_dir) - print("Started Chatterino.") + now = datetime.now() + timenow = now.strftime("%H:%M:%S") + print("[" + timenow + "] Started Chatterino.") # Function to display system tray icon def on_quit_callback(icon): @@ -52,9 +55,13 @@ if __name__ == '__main__': # Loop to check if Chatterino is running every 10 minutes while True: if is_chatterino_running(): - print("Chatterino is running. Rechecking in 10 minutes.") + now = datetime.now() + timenow = now.strftime("%H:%M:%S") + print("[" + timenow + "] Chatterino is running. Rechecking in 10 minutes.") else: - print("Chatterino is not running. Starting in 30 seconds...") + now = datetime.now() + timenow = now.strftime("%H:%M:%S") + print("[" + timenow + "] Chatterino is not running. Starting in 30 seconds...") time.sleep(30) run_program(program_path) time.sleep(1) # wait for system tray icon to initialize