Improve logging by excluding specific unauthenticated session requests

Exclude logging of 401 status codes for the /api/auth/session endpoint in the request logger middleware.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: ae4037a0-2a6f-4530-9bac-79b543286bda
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/397bca8c-984f-43ff-841a-10897aeb8140/ae4037a0-2a6f-4530-9bac-79b543286bda/wfvl0l3
This commit is contained in:
michaelschal committed 2025-10-04 11:37:55 +00:00
1 parent 41dfbfe804
commit 7fa93b11e3
2 files changed
+9

No files matched your search

+4
View File
@@ -26,6 +26,10 @@ externalPort = 3000
localPort = 43245
externalPort = 3001
[[ports]]
localPort = 46341
externalPort = 3003
[env]
PORT = "5000"
+5
View File
@@ -58,6 +58,11 @@ app.use((req, res, next) => {
res.on("finish", () => {
const duration = Date.now() - start;
if (path.startsWith("/api")) {
// Ne pas logger les 401 sur /api/auth/session (vérification normale de session)
if (path === "/api/auth/session" && res.statusCode === 401) {
return;
}
let logLine = `${req.method} ${path} ${res.statusCode} in ${duration}ms`;
if (capturedJsonResponse) {
logLine += ` :: ${JSON.stringify(capturedJsonResponse)}`;