mirror of
https://github.com/jsbin/jsbin.git
synced 2026-02-01 16:46:05 +00:00
Log from within the runner to get proper object.
This commit is contained in:
parent
af6310ec76
commit
98e632498a
@ -247,26 +247,26 @@ window._console = {
|
||||
for (; i < l; i++) {
|
||||
log(''+arguments[i], true);
|
||||
}
|
||||
window.console.log.apply(window.console, arguments);
|
||||
// window.console.log.apply(window.console, arguments);
|
||||
},
|
||||
dir: function () {
|
||||
var l = arguments.length, i = 0;
|
||||
for (; i < l; i++) {
|
||||
log(arguments[i]);
|
||||
}
|
||||
window.console.dir.apply(window.console, arguments);
|
||||
// window.console.dir.apply(window.console, arguments);
|
||||
},
|
||||
props: function (obj) {
|
||||
var props = [], realObj;
|
||||
try {
|
||||
for (var p in obj) props.push(p);
|
||||
} catch (e) {}
|
||||
window.console.props.apply(window.console, arguments);
|
||||
// window.console.props.apply(window.console, arguments);
|
||||
return props;
|
||||
},
|
||||
error: function (err) {
|
||||
log(err.message || err, 'error');
|
||||
window.console.error.apply(window.console, arguments);
|
||||
// window.console.error.apply(window.console, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -71,7 +71,7 @@ var proxyconsole = (function () {
|
||||
|
||||
// Create each of these methods on the proxy, and postMessage up to JS Bin
|
||||
// when one is called.
|
||||
var methods = ['debug', 'error', 'info', 'log', 'warn', 'dir'];
|
||||
var methods = ['debug', 'error', 'info', 'log', 'warn', 'dir', 'props'];
|
||||
methods.forEach(function (method) {
|
||||
// Create console method
|
||||
proxyconsole[method] = function () {
|
||||
@ -83,6 +83,11 @@ var proxyconsole = (function () {
|
||||
method: method,
|
||||
args: JSON.stringify(args)
|
||||
});
|
||||
// If the browner supports it, use the browser console
|
||||
if (window.console) {
|
||||
if (!console[method]) method = 'log';
|
||||
console[method].apply(console, originalArgs);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user