Verbesssertes Logging und blacklist

This commit is contained in:
Kaaninchen
2026-07-20 13:22:16 +02:00
parent 9f1ce60aa6
commit 055514d6aa
5 changed files with 15 additions and 4 deletions
+5 -3
View File
@@ -38,7 +38,7 @@ def random_connection():
departures = [
d for d in data.get("departures", [])
if d.get("scheduledDeparture") and d.get("destination") != station
and not d.get("train", "").startswith("S ")
and not d.get("train", "").startswith(tuple(config["blacklist"]))
]
if not departures:
@@ -117,6 +117,8 @@ def operator_metadata(operator):
return operators_module.OPERATORS.get(operator, operators_module.OPERATORS["fallback"])
def logger(msg):
def logger(msg, log_type="info"):
current_time = datetime.now().strftime('%X')
print(f"{current_time}: {msg}")
print(f"{current_time}: {log_type.upper()}: {msg}")
if log_type.lower() == "fatal":
os._exit(1)