def notify(level, instance, signal=None, **kwargs): if 'observer' in kwargs: title = '{0}: {1}'.format(level.upper(), kwargs['observer'].name) else: title = kwargs.pop('title', instance) api = PushoverApi(settings.PUSHOVER_TOKEN) api.send_notification( settings.PUSHOVER_RECIPIENT, title, level, alert=instance, **kwargs)
def emit(self, record): try: from django.conf import settings from terrarium.watchdog.pushover import PushoverApi kwargs = { 'record': record, } api = PushoverApi(settings.PUSHOVER_TOKEN) api.send_notification( settings.PUSHOVER_RECIPIENT_SERVER_ERROR, 'Server Error', 'server', **kwargs) except: pass