add SILENT_DEBUG option, and make that log to the browser console

This commit is contained in:
Andy Janata 2012-01-28 00:49:50 -08:00
parent 8ad224edad
commit 237c4ccec2
2 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,7 @@
var cah = {};
cah.DEBUG = true;
cah.DEBUG = false;
cah.SILENT_DEBUG = true;
/**
* This client's nickname.

View File

@ -34,6 +34,9 @@ cah.log.error = function(text) {
* opt_obj Optional. Object to dump along with message.
*/
cah.log.debug = function(text, opt_obj) {
if (cah.SILENT_DEBUG && console) {
console.debug("[" + new Date().toLocaleTimeString() + "]", text, opt_obj);
}
if (cah.DEBUG) {
if (opt_obj) {
if (JSON && JSON.stringify) {