From c2b8656783c503c91967539f17a6eeebc60e0c16 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Wed, 29 Oct 2025 13:41:31 +0100 Subject: [PATCH] Refactor request logging middleware to simplify endpoint exclusion logic Updated the requestLoggingMiddleware to streamline the logic for excluding specific endpoints from logging. The new implementation checks for 'status' in the path and handles root paths more efficiently, improving code readability and maintainability. --- backend/middleware/requestLoggingMiddleware.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/backend/middleware/requestLoggingMiddleware.js b/backend/middleware/requestLoggingMiddleware.js index 5a1d2e3..2c69b5b 100644 --- a/backend/middleware/requestLoggingMiddleware.js +++ b/backend/middleware/requestLoggingMiddleware.js @@ -43,15 +43,14 @@ export const requestLoggingMiddleware = async (req, res, next) => { // Skip logging for non-data endpoints (Status-Checks, Health-Checks, etc.) // Nur Daten-Abrufe von API-Endpunkten werden geloggt - const skipPaths = [ - '/status', - '/session/status', - '/health', - '/', - '/scheduler-status' - ]; - - if (skipPaths.some(skipPath => path.includes(skipPath))) { + // Exclude any endpoint containing 'status' or root paths + if ( + path.includes('/status') || + path === '/' || + path === '/health' || + path.endsWith('/status') || + path.includes('/scheduler-status') + ) { return; }