From 335e2ca0d5f10d8e596a8ed6e15d7e74eb1cf755 Mon Sep 17 00:00:00 2001 From: Akansha Sakhre Date: Fri, 4 Oct 2024 14:14:35 +0530 Subject: [PATCH 1/3] added logs --- src/config/apolloclient.ts | 2 +- src/config/logs.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/config/apolloclient.ts b/src/config/apolloclient.ts index 4b0540d11..47f22d535 100644 --- a/src/config/apolloclient.ts +++ b/src/config/apolloclient.ts @@ -105,7 +105,7 @@ const gqlClient = (navigate: any) => { // @ts-ignore switch (networkError.statusCode) { case 401: - setLogs(`Error 401: logging user out`, 'error'); + setLogs(`Error 401: logging user out, ${JSON.stringify(networkError)}`, 'error'); navigate('/logout/session'); break; default: diff --git a/src/config/logs.ts b/src/config/logs.ts index e53820735..4f0106e55 100644 --- a/src/config/logs.ts +++ b/src/config/logs.ts @@ -1,8 +1,12 @@ import pino from 'pino'; import { createPinoBrowserSend, createWriteStream } from 'pino-logflare'; import { LOGFLARE_API, LOGFLARE_SOURCE } from '.'; +import { getUserSession } from 'services/AuthService'; const setLogs = (message: any, type: string) => { + const orgId = getUserSession('organizationId'); + const userId = getUserSession('id'); + let logger: any; if (LOGFLARE_API && LOGFLARE_SOURCE) { @@ -38,6 +42,8 @@ const setLogs = (message: any, type: string) => { logMessage = JSON.stringify(message); } + logMessage = `org_id: ${orgId} user_id: ${userId} [${type}] ${message}`; + // log some events switch (type) { case 'info': From d27bd98be79eef28f7d7cdb6a77128b0ff8d69cf Mon Sep 17 00:00:00 2001 From: Akansha Sakhre Date: Fri, 4 Oct 2024 14:17:44 +0530 Subject: [PATCH 2/3] added logs --- src/config/logs.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/logs.ts b/src/config/logs.ts index 4f0106e55..dc568de7e 100644 --- a/src/config/logs.ts +++ b/src/config/logs.ts @@ -37,7 +37,7 @@ const setLogs = (message: any, type: string) => { stream ); - let logMessage = message; + let logMessage; if (typeof message === 'object') { logMessage = JSON.stringify(message); } From 69a8f027f2dee4fbfa9781738edb596790f91207 Mon Sep 17 00:00:00 2001 From: Akansha Sakhre Date: Fri, 4 Oct 2024 14:36:31 +0530 Subject: [PATCH 3/3] added logs --- src/config/logs.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/logs.ts b/src/config/logs.ts index dc568de7e..ef1bbc050 100644 --- a/src/config/logs.ts +++ b/src/config/logs.ts @@ -39,7 +39,7 @@ const setLogs = (message: any, type: string) => { let logMessage; if (typeof message === 'object') { - logMessage = JSON.stringify(message); + message = JSON.stringify(message); } logMessage = `org_id: ${orgId} user_id: ${userId} [${type}] ${message}`;