mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-26 15:15:49 +00:00
Update in-browser logging to accommodate n-args
This commit is contained in:
@@ -3,9 +3,17 @@ var exports = module.exports = require('./utils.js');
|
|||||||
// We override this function for browsers, because they print objects nicer
|
// We override this function for browsers, because they print objects nicer
|
||||||
// natively than JSON.stringify can.
|
// natively than JSON.stringify can.
|
||||||
exports.logObject = function (msg, obj) {
|
exports.logObject = function (msg, obj) {
|
||||||
|
var args = Array.prototype.slice.call(arguments, 1);
|
||||||
|
|
||||||
|
args = args.map(function(arg) {
|
||||||
if (/MSIE/.test(navigator.userAgent)) {
|
if (/MSIE/.test(navigator.userAgent)) {
|
||||||
console.log(msg, JSON.stringify(obj));
|
return JSON.stringify(arg, null, 2);
|
||||||
} else {
|
} else {
|
||||||
console.log(msg, "", obj);
|
return arg;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
args.unshift(msg);
|
||||||
|
|
||||||
|
console.log.apply(console, args);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user