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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user