(hack - do not merge): merge console arguments into single string

Selenium WebDriver stores only the 1st argument as "msg" and the rest
of the logs is not available.

(cherry picked from commit b3db133)
This commit is contained in:
paweldomas 2018-03-12 11:03:43 -05:00
parent eb5ce780d8
commit 4b62751c3a
1 changed files with 36 additions and 0 deletions

View File

@ -9,6 +9,42 @@
<script>
window.indexLoadedTime = window.performance.now();
var defaultConsole = console;
function argsToJSON(args) {
var msg = '';
for (var idx = 1; idx < args.length; idx += 1) {
const arg = args[idx];
if (typeof arg === 'object') {
msg += ' [obj] ';
} else {
msg += arg + ' ';
}
}
return msg;
}
console = {
log() {
defaultConsole.log.apply(defaultConsole, [argsToJSON(arguments)]);
},
info(msg) {
defaultConsole.info.apply(defaultConsole, [argsToJSON(arguments)]);
},
debug(msg) {
defaultConsole.debug.apply(defaultConsole, [argsToJSON(arguments)]);
},
warn(msg) {
defaultConsole.warn.apply(defaultConsole, [argsToJSON(arguments)]);
},
error(msg) {
defaultConsole.error.apply(defaultConsole, [argsToJSON(arguments)]);
},
trace(msg) {
defaultConsole.trace.apply(defaultConsole, [argsToJSON(arguments)]);
}
}
console.log("(TIME) index.html loaded:\t", indexLoadedTime);
// XXX the code below listeners for errors and displays an error message
// in the document body when any of the required files fails to load.