Add gotify handler

This commit is contained in:
Nyymix 2025-03-22 00:45:34 +02:00
parent a053aca70a
commit ce5031b64f

View file

@ -0,0 +1,18 @@
import logging
import requests
from django.conf import settings
class GotifyHandler(logging.Handler):
def emit(self, record):
log_entry = self.format(record)
try:
requests.post(
settings.GOTIFY_URL,
headers={"X-Gotify-Key": settings.GOTIFY_TOKEN},
json={"message": log_entry, "priority": 5, "title": "Gallery Error"},
timeout=5,
)
except requests.exceptions.RequestException:
pass