diff --git a/changedetectionio/__init__.py b/changedetectionio/__init__.py index cbc4854e..123d16dd 100644 --- a/changedetectionio/__init__.py +++ b/changedetectionio/__init__.py @@ -924,7 +924,7 @@ def changedetection_app(config=None, datastore_o=None): def notification_logs(): global notification_debug_log output = render_template("notification-log.html", - logs=notification_debug_log if len(notification_debug_log) else ["No errors or warnings detected"]) + logs=notification_debug_log if len(notification_debug_log) else ["Notification logs are empty - no notifications sent yet."]) return output @@ -1244,6 +1244,9 @@ def check_for_new_version(): def notification_runner(): global notification_debug_log + from datetime import datetime + import json + while not app.config.exit.is_set(): try: # At the moment only one thread runs (single runner) @@ -1252,9 +1255,12 @@ def notification_runner(): time.sleep(1) else: - # Process notifications + + now = datetime.now() + try: from changedetectionio import notification + notification.process_notification(n_object, datastore) except Exception as e: @@ -1268,9 +1274,10 @@ def notification_runner(): log_lines = str(e).splitlines() notification_debug_log += log_lines - # Trim the log length - notification_debug_log = notification_debug_log[-100:] - + # Process notifications + notification_debug_log+= ["{} - SENDING {}".format(now.strftime("%Y/%m/%d %H:%M:%S,000"), json.dumps(n_object))] + # Trim the log length + notification_debug_log = notification_debug_log[-100:] # Thread runner to check every minute, look for new watches to feed into the Queue. def ticker_thread_check_time_launch_checks(): diff --git a/changedetectionio/notification.py b/changedetectionio/notification.py index b3d07d9a..4ee520b0 100644 --- a/changedetectionio/notification.py +++ b/changedetectionio/notification.py @@ -97,6 +97,8 @@ def process_notification(n_object, datastore): if log_value and 'WARNING' in log_value or 'ERROR' in log_value: raise Exception(log_value) + + # Notification title + body content parameters get created here. def create_notification_parameters(n_object, datastore): from copy import deepcopy diff --git a/changedetectionio/templates/_common_fields.jinja b/changedetectionio/templates/_common_fields.jinja index 961ff1db..418abc16 100644 --- a/changedetectionio/templates/_common_fields.jinja +++ b/changedetectionio/templates/_common_fields.jinja @@ -14,7 +14,7 @@
discord://
only supports a maximum 2,000 characters of notification text, including the title.tgram://
bots cant send messages to other bots, so you should specify chat ID of non-bot user.