fix(client): use JSON.stringify replacer function for NaN (#37684)
This commit is contained in:
@ -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();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user