Skip to content

Commit 3365894

Browse files
committed
improve log output a bit
1 parent 6513bb0 commit 3365894

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/common/EvalIFrame.res

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,17 @@ let srcDoc = `
4545
});
4646
const sendLog = (logLevel) => (...args) => {
4747
let finalArgs = args.map(arg => {
48-
if (typeof arg === 'object') {
49-
return JSON.stringify(arg);
48+
if (arg === undefined) {
49+
return 'undefined';
50+
}
51+
else if (typeof arg === 'object') {
52+
return JSON.stringify(arg, Object.getOwnPropertyNames(arg));
53+
} else if (typeof arg === 'function') {
54+
return '[function]';
5055
}
5156
return arg;
5257
});
53-
parent.window.postMessage({ type: logLevel, args: finalArgs }, '*')
58+
parent.window.postMessage({ type: logLevel, args: finalArgs }, '*');
5459
};
5560
console.log = sendLog('log');
5661
console.warn = sendLog('warn');

0 commit comments

Comments
 (0)