update addLogLine signature to similar to console log

This commit is contained in:
Abhinav 2023-01-31 12:29:48 +05:30
parent d884ccd2e1
commit 95f20bcbd6

View file

@ -20,27 +20,21 @@ export interface Log {
logLine: string; logLine: string;
} }
// commented out need fixing export function addLogLine(log: any, ...optionalParams: any[]) {
export function pipeConsoleLogsToDebugLogs() { try {
return; const completeLog =
const oldLog = console.log; JSON.stringify(log) +
console.log = function (...args) { optionalParams.map((x) => JSON.stringify(x)).join(' ');
addLogLine(args.map((x) => JSON.stringify(x)).join(' ')); if (isDEVSentryENV()) {
oldLog.apply(console, args); console.log(completeLog);
};
} }
export function addLogLine(log: string) {
try {
if (isDEVSentryENV()) {
console.log(log);
}
if (isElectron()) { if (isElectron()) {
ElectronService.logToDisk(log); ElectronService.logToDisk(completeLog);
} else { } else {
saveLogLine({ saveLogLine({
timestamp: Date.now(), timestamp: Date.now(),
logLine: log, logLine: completeLog,
}); });
} }
} catch (e) { } catch (e) {