fix(client): use JSON.stringify replacer function for NaN (#37684)

This commit is contained in:
lasjorg
2019-11-10 13:17:18 +01:00
committed by mrugesh
parent 32954923e1
commit e1a1ed5c12

View File

@ -16,9 +16,16 @@ const __utils = (() => {
} }
} }
function replacer(key, value) {
if (Number.isNaN(value)) {
return 'NaN';
}
return value;
}
const oldLog = self.console.log.bind(self.console); const oldLog = self.console.log.bind(self.console);
self.console.log = function proxyConsole(...args) { self.console.log = function proxyConsole(...args) {
logs.push(args.map(arg => '' + JSON.stringify(arg)).join(' ')); logs.push(args.map(arg => '' + JSON.stringify(arg, replacer)).join(' '));
if (logs.join('\n').length > MAX_LOGS_SIZE) { if (logs.join('\n').length > MAX_LOGS_SIZE) {
flushLogs(); flushLogs();
} }