From 5c2d59aa1a175ca0c74cd7ad8f46ea860d736fed Mon Sep 17 00:00:00 2001 From: Thomas Rusiecki Date: Fri, 6 Dec 2024 19:48:31 -0300 Subject: [PATCH] changed tab to log and added logging --- action/views.py | 9 +++++++-- device/templates/details.html | 8 ++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/action/views.py b/action/views.py index 1fdfe9d..36f3152 100644 --- a/action/views.py +++ b/action/views.py @@ -6,7 +6,8 @@ from action.models import State, StateDefinition from device.models import Device import logging -logger = logging.getLogger(__name__) + +device_logger = logging.getLogger('device_log') class NewActionView(View): @@ -26,9 +27,13 @@ class NewActionView(View): user=request.user, institution=request.user.institution, ) + #TODO: also change logger for full fledged table + device_logger.info( + f"Updated State to (key='{state_definition.state}', for device value='{snapshot_uuid}') by user {self.request.user}." + ) messages.success(request, f"Action to '{state_definition.state}' has been added.") return redirect(request.META.get('HTTP_REFERER')) else: messages.error(request, "There was an error with your submission.") - return redirect(request.META.get('HTTP_REFERER')) \ No newline at end of file + return redirect(request.META.get('HTTP_REFERER')) diff --git a/device/templates/details.html b/device/templates/details.html index 344b33f..9bee865 100644 --- a/device/templates/details.html +++ b/device/templates/details.html @@ -38,7 +38,7 @@ {% trans 'General details' %}