IE doesn't have console.debug, and it also is a pain to log with an object.
This commit is contained in:
parent
84373a5453
commit
0f14cb781c
|
@ -35,7 +35,23 @@ cah.log.error = function(text) {
|
|||
*/
|
||||
cah.log.debug = function(text, opt_obj) {
|
||||
if (cah.SILENT_DEBUG && console) {
|
||||
if (console.debug) {
|
||||
console.debug("[" + new Date().toLocaleTimeString() + "]", text, opt_obj);
|
||||
} else if (console.log) {
|
||||
console.log("[" + new Date().toLocaleTimeString() + "] " + text);
|
||||
if (opt_obj) {
|
||||
if (console.dir) {
|
||||
console.dir(opt_obj);
|
||||
} else if (JSON && JSON.stringify) {
|
||||
console.log(JSON.stringify(opt_obj));
|
||||
} else {
|
||||
console.log("TODO: SILENT_DEBUG without console.debug, with console.log, "
|
||||
+ "without console.dir, without JSON.stringify");
|
||||
}
|
||||
}
|
||||
} else if (console.log) {
|
||||
console.log("[" + new Date().toLocaleTimeString() + "]", text, opt_obj);
|
||||
}
|
||||
}
|
||||
if (cah.DEBUG) {
|
||||
if (opt_obj) {
|
||||
|
|
Loading…
Reference in New Issue