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;
}
// 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: any, ...optionalParams: any[]) {
try {
const completeLog =
JSON.stringify(log) +
optionalParams.map((x) => JSON.stringify(x)).join(' ');
if (isDEVSentryENV()) {
console.log(completeLog);
}
export function addLogLine(log: string) {
try {
if (isDEVSentryENV()) {
console.log(log);
}
if (isElectron()) {
ElectronService.logToDisk(log);
ElectronService.logToDisk(completeLog);
} else {
saveLogLine({
timestamp: Date.now(),
logLine: log,
logLine: completeLog,
});
}
} catch (e) {