예제 #1
0
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)
예제 #2
0
파일: loggers.py 프로젝트: deluge/terrarium
    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