Merge "Adds javascript console logging for debug mode."

This commit is contained in:
Jenkins 2012-08-15 16:25:36 +00:00 committed by Gerrit Code Review
commit 401be66e81
2 changed files with 8 additions and 3 deletions

View File

@ -44,9 +44,7 @@ horizon.datatables = {
$table.trigger("update");
break;
default:
if (horizon.conf.debug) {
horizon.alert("error", gettext("An error occurred while updating."));
}
horizon.utils.log(gettext("An error occurred while updating."));
$row.removeClass("ajax-update");
$row.find("i.ajax-updating").remove();
break;

View File

@ -1,5 +1,12 @@
/* Utilities for common needs which aren't JS builtins. */
horizon.utils = {
// Log function which checks for DEBUG and the existence of a console.
log: function (thing_to_log) {
if (horizon.conf.debug && typeof(console) !== "undefined" && typeof(console.log) !== "undefined") {
console.log(thing_to_log);
}
},
capitalize: function(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
},