From 29b3093c14f3972ad1302ed26953aa44a164038e Mon Sep 17 00:00:00 2001 From: Janic Duplessis Date: Mon, 6 May 2024 20:10:47 -0400 Subject: [PATCH] Add request time in logs --- src/libs/Middleware/Logging.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/Middleware/Logging.ts b/src/libs/Middleware/Logging.ts index 97f4a21866c5..19d767c8a4b1 100644 --- a/src/libs/Middleware/Logging.ts +++ b/src/libs/Middleware/Logging.ts @@ -35,10 +35,11 @@ function logRequestDetails(message: string, request: Request, response?: Respons } const Logging: Middleware = (response, request) => { + const startTime = Date.now(); logRequestDetails('Making API request', request); return response .then((data) => { - logRequestDetails('Finished API request', request, data); + logRequestDetails(`Finished API request in ${Date.now() - startTime}ms`, request, data); return data; }) .catch((error) => {