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.
This commit is contained in:
Torsten Schulz (local)
2025-10-29 13:41:31 +01:00
parent 0b1e745f03
commit c2b8656783

View File

@@ -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;
}