From 6a3b06f3714165bed21a65992bb5626719a0c4d3 Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Wed, 4 Dec 2019 20:28:06 +0100 Subject: [PATCH] Debug log in alert module --- restic_compose_backup/alerts/__init__.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/restic_compose_backup/alerts/__init__.py b/restic_compose_backup/alerts/__init__.py index 136b044..785d892 100644 --- a/restic_compose_backup/alerts/__init__.py +++ b/restic_compose_backup/alerts/__init__.py @@ -1,24 +1,25 @@ +import logging + from restic_compose_backup.alerts.smtp import SMTPAlert from restic_compose_backup.alerts.discord import DiscordWebhookAlert from restic_compose_backup.config import Config +logger = logging.getLogger(__name__) + ALERT_INFO = 'INFO', ALERT_ERROR = 'ERROR' ALERT_TYPES = [ALERT_INFO, ALERT_ERROR] BACKENDS = [SMTPAlert, DiscordWebhookAlert] -def send(subject: str = None, attachment: str = None, alert_type: str = ALERT_ERROR): - """Send an alert""" - pass - - def configured_alert_classes(): """Returns a list of configured alert class instances""" + logger.debug('Getting alert backends') entires = [] for cls in BACKENDS: instance = cls.create_from_env() + logger.debug("Alert backend '%s' configured: %s", cls.name, instance != None) if instance: entires.append(instance)