From 95f20bcbd6fd0164b07c97bc5579d647bdbb4693 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 31 Jan 2023 12:29:48 +0530 Subject: [PATCH] update addLogLine signature to similar to console log --- src/utils/logging/index.ts | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/utils/logging/index.ts b/src/utils/logging/index.ts index 1b08de54c..58b4acc4e 100644 --- a/src/utils/logging/index.ts +++ b/src/utils/logging/index.ts @@ -20,27 +20,21 @@ export interface Log { logLine: string; } -// commented out need fixing -export function pipeConsoleLogsToDebugLogs() { - return; - const oldLog = console.log; - console.log = function (...args) { - addLogLine(args.map((x) => JSON.stringify(x)).join(' ')); - oldLog.apply(console, args); - }; -} - -export function addLogLine(log: string) { +export function addLogLine(log: any, ...optionalParams: any[]) { try { + const completeLog = + JSON.stringify(log) + + optionalParams.map((x) => JSON.stringify(x)).join(' '); if (isDEVSentryENV()) { - console.log(log); + console.log(completeLog); } + if (isElectron()) { - ElectronService.logToDisk(log); + ElectronService.logToDisk(completeLog); } else { saveLogLine({ timestamp: Date.now(), - logLine: log, + logLine: completeLog, }); } } catch (e) {