Example #1
0
    def enablePushover(self, userkey, APIkey):
        self.pushover = namedtuple('Pushover', 'notifier APIkey userkey')(
            get_notifier('pushover'),
            APIkey,
            userkey,
        )

        defaults = {
            'user': userkey,
            'token': APIkey,
        }
        handler = NotificationHandler('pushover', defaults=defaults)
        handler.setLevel(logging.ERROR)
        handler.setFormatter(logging.Formatter('%(asctime)s - %(message)s'))
        log = logging.getLogger()
        log.addHandler(handler)
        self.notify('Pushover enabled for logging')
Example #2
0
    def enableTelegram(self, chatID, token):
        self.telegram = namedtuple('Telegram', 'notifier chatID token')(
            get_notifier('telegram'),
            chatID,
            token,
        )

        defaults = {
            'chat_id': chatID,
            'token': token,
        }
        handler = NotificationHandler('telegram', defaults=defaults)
        handler.setLevel(logging.ERROR)
        handler.setFormatter(logging.Formatter('%(asctime)s - %(message)s'))
        log = logging.getLogger()
        log.addHandler(handler)
        self.notify('Telegram enabled for logging')