fix: Better logging and revie system of debug

This commit is contained in:
Julien Froidefond
2025-02-23 22:19:24 +01:00
parent c7b2621946
commit 66e1db7788
11 changed files with 70 additions and 110 deletions

View File

@@ -53,34 +53,12 @@ export abstract class BaseApiService {
type: CacheType = "DEFAULT"
): Promise<T> {
const cacheService = await getServerCacheService();
const startTime = performance.now();
try {
const result = await cacheService.getOrSet(key, fetcher, type);
const endTime = performance.now();
// Log la requête avec l'indication du cache
await DebugService.logRequest({
url: key,
startTime,
endTime,
fromCache: true,
cacheType: type,
});
return result;
} catch (error) {
const endTime = performance.now();
// Log aussi les erreurs
await DebugService.logRequest({
url: key,
startTime,
endTime,
fromCache: true,
cacheType: type,
});
throw error;
}
}