mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-16 07:50:16 +02:00
Display newline characters in notification view
This commit is contained in:
parent
8697d075a8
commit
3d82dd84c9
@ -2,6 +2,8 @@ import logging
|
|||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from .models import Notification
|
from .models import Notification
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class NotificationHandler(logging.Handler):
|
class NotificationHandler(logging.Handler):
|
||||||
def emit(self, record):
|
def emit(self, record):
|
||||||
for user in User.objects.all():
|
for user in User.objects.all():
|
||||||
@ -10,5 +12,8 @@ class NotificationHandler(logging.Handler):
|
|||||||
notif.user = user
|
notif.user = user
|
||||||
notif.title = "%s [%s:%s]" % (record.levelname, record.funcName, record.lineno)
|
notif.title = "%s [%s:%s]" % (record.levelname, record.funcName, record.lineno)
|
||||||
notif.level = str([item[0] for item in Notification.LEVEL_CHOICES if item[1] == record.levelname][0])
|
notif.level = str([item[0] for item in Notification.LEVEL_CHOICES if item[1] == record.levelname][0])
|
||||||
notif.message = record.getMessage()
|
message = record.getMessage()
|
||||||
|
message = message + "\n\n"
|
||||||
|
message = message + record.exc_text
|
||||||
|
notif.message = message
|
||||||
notif.save()
|
notif.save()
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div class="panel panel-{{ notif.level }}">
|
<div class="panel panel-{{ notif.level }}">
|
||||||
<div class="panel-heading">{{ notif.timestamp }} {{ notif.title }}</div>
|
<div class="panel-heading">{{ notif.timestamp }} {{ notif.title }}</div>
|
||||||
<div class="panel-body">{{ notif.message }}</div>
|
<div class="panel-body"><pre>{{ notif.message }}</pre></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user