2010-04-13 15:28:53 +01:00
|
|
|
if ((!window.console) || (! /__debug__$/i.test(document.location.href))) {
|
2010-05-05 21:40:05 +01:00
|
|
|
// non-debug mode, an empty function
|
2010-04-13 15:28:53 +01:00
|
|
|
window.console = window.console || {};
|
|
|
|
window.console.log = function(message) {};
|
2010-04-19 00:43:03 +01:00
|
|
|
window.console.warn = function(message) {};
|
|
|
|
window.console.error = function(message) {};
|
2010-04-13 15:28:53 +01:00
|
|
|
}
|
|
|
|
|
2010-04-18 22:28:54 +01:00
|
|
|
function dirObj(obj, depth, parent) {
|
2010-04-13 15:28:53 +01:00
|
|
|
var msg = "";
|
|
|
|
var val = "";
|
|
|
|
if (! depth) { depth=2; }
|
|
|
|
if (! parent) { parent= ""; }
|
|
|
|
|
|
|
|
// Print the properties of the passed-in object
|
|
|
|
for (var i in obj) {
|
|
|
|
if ((depth > 1) && (typeof obj[i] == "object")) {
|
|
|
|
// Recurse attributes that are objects
|
2010-04-18 22:28:54 +01:00
|
|
|
msg += dirObj(obj[i], depth-1, parent + "." + i);
|
2010-04-13 15:28:53 +01:00
|
|
|
} else {
|
|
|
|
val = new String(obj[i]).replace("\n", " ");
|
|
|
|
if (val.length > 30) {
|
|
|
|
val = val.substr(0,30) + "...";
|
|
|
|
}
|
|
|
|
msg += parent + "." + i + ": " + val + "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return msg;
|
|
|
|
}
|