Reduce production latency by conditionally logging API requests and responses

Conditionally disable verbose logging in production to resolve latency issues caused by excessive console output in API requests and responses.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7c468936-2a88-4686-ac0a-84921a45222d
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/7c468936-2a88-4686-ac0a-84921a45222d/B7k6m01
This commit is contained in:
michaelschal committed 2025-08-13 16:08:41 +00:00
1 parent 947896c212
commit da2af1e29d
6 files changed
+57 -26

No files matched your search

+8 -2
View File
@@ -13,7 +13,10 @@ export async function apiRequest(
body?: unknown,
headers: Record<string, string> = {}
): Promise<any> {
console.log("🌐 API Request:", { url, method, body });
// Logging désactivé en production pour éviter la latence
if (import.meta.env.DEV) {
console.log("🌐 API Request:", { url, method });
}
const res = await fetch(url, {
method,
@@ -25,7 +28,10 @@ export async function apiRequest(
credentials: "include",
});
console.log("🌐 API Response:", { status: res.status, ok: res.ok });
// Logging des erreurs uniquement en production
if (!res.ok || import.meta.env.DEV) {
console.log("🌐 API Response:", { status: res.status, ok: res.ok, url });
}
await throwIfResNotOk(res);