diff --git a/alerts/player.py b/alerts/player.py index 45184c1..ff1b437 100644 --- a/alerts/player.py +++ b/alerts/player.py @@ -5,6 +5,7 @@ from datetime import datetime, timedelta from helpers.os_environment import resolve_external_file_path from helpers.alert_manager import AlertProvider from baps_types.alert import CRITICAL, WARNING, Alert +from baps_types.happytime import happytime MODULE = "Player" # This should match the log file, so the UI will link to the logs page. @@ -86,7 +87,7 @@ class PlayerAlertProvider(AlertProvider): This likely means there was an unhandled exception in the player code, causing the server to restart the player. Please check player logs to investigate the cause. Please restart the server to clear this warning.""" - .format(channel, str(start_time).rsplit(".",1)[0], str(server_start_time).rsplit(".",1)[0]), + .format(channel, happytime(start_time), happytime(server_start_time)), "module": MODULE+str(channel), "severity": WARNING })) diff --git a/alerts/server.py b/alerts/server.py index 7b56151..375f87d 100644 --- a/alerts/server.py +++ b/alerts/server.py @@ -5,6 +5,7 @@ from datetime import datetime, timedelta from helpers.os_environment import resolve_external_file_path from helpers.alert_manager import AlertProvider from baps_types.alert import CRITICAL, WARNING, Alert +from baps_types.happytime import happytime MODULE = "BAPSicleServer" # This should match the log file, so the UI will link to the logs page. @@ -66,7 +67,7 @@ class ServerAlertProvider(AlertProvider): It may have been automatically restarted by the OS. If this is not expected, please check logs to investigate why BAPSicle restarted/crashed.""" - .format(str(start_time).rsplit(".",1)[0]), + .format(happytime(start_time)), "module": MODULE, "severity": WARNING })] diff --git a/baps_types/happytime.py b/baps_types/happytime.py new file mode 100644 index 0000000..898730e --- /dev/null +++ b/baps_types/happytime.py @@ -0,0 +1,3 @@ +from datetime import datetime +def happytime(date: datetime): + return date.strftime("%Y-%m-%d %H:%M:%S") diff --git a/ui-templates/alerts.html b/ui-templates/alerts.html index 36e5fdd..c90fd60 100644 --- a/ui-templates/alerts.html +++ b/ui-templates/alerts.html @@ -5,14 +5,10 @@ {% endblock %} {% block content_inner %} {% if data %} -
{{ alert.description | replace("\n\n", "
") | replace("\n", "
")}}