From 9d36f99404f7551d5157342b1d4f21eca6d96db9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mose=20M=C3=BCller?= Date: Mon, 27 Nov 2023 16:15:53 +0100 Subject: [PATCH] adds CRITICAL log level --- frontend/src/App.css | 2 +- frontend/src/components/NotificationsComponent.tsx | 3 ++- src/pydase/utils/logging.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/App.css b/frontend/src/App.css index 15fce39..8d679da 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -23,7 +23,7 @@ input.instantUpdate { .warningToast { background-color: rgba(255, 181, 44, 0.603) !important; } -.errorToast, .exceptionToast { +.errorToast, .criticalToast { background-color: rgba(216, 41, 18, 0.678) !important; } .buttonComponent { diff --git a/frontend/src/components/NotificationsComponent.tsx b/frontend/src/components/NotificationsComponent.tsx index e756fc4..d023123 100644 --- a/frontend/src/components/NotificationsComponent.tsx +++ b/frontend/src/components/NotificationsComponent.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { ToastContainer, Toast } from 'react-bootstrap'; -export type LevelName = 'ERROR' | 'WARNING' | 'INFO' | 'DEBUG'; +export type LevelName = 'CRITICAL' | 'ERROR' | 'WARNING' | 'INFO' | 'DEBUG'; export type Notification = { id: number; timeStamp: string; @@ -24,6 +24,7 @@ export const Notifications = React.memo((props: NotificationProps) => { // Determine if the toast should be shown const shouldShow = notification.levelname === 'ERROR' || + notification.levelname === 'CRITICAL' || (showNotification && ['WARNING', 'INFO', 'DEBUG'].includes(notification.levelname)); diff --git a/src/pydase/utils/logging.py b/src/pydase/utils/logging.py index c0a7d08..617792c 100644 --- a/src/pydase/utils/logging.py +++ b/src/pydase/utils/logging.py @@ -38,7 +38,7 @@ class DefaultFormatter(uvicorn.logging.ColourizedFormatter): class SocketIOHandler(logging.Handler): """ - Custom logging handler that emits ERROR and EXCEPTION log records to a Socket.IO + Custom logging handler that emits ERROR and CRITICAL log records to a Socket.IO server, allowing for real-time logging in applications that use Socket.IO for communication. """