Commit c1eba48f authored by Joel Martin's avatar Joel Martin

logging: add Util.get_logging(), canvas clearing.

Only clear canvas if log level is not debug instead of using
'#__debug__' in the URL.
parent 57c7903f
...@@ -366,7 +366,7 @@ updateState = function(state, statusMsg) { ...@@ -366,7 +366,7 @@ updateState = function(state, statusMsg) {
if (canvas && canvas.getContext()) { if (canvas && canvas.getContext()) {
canvas.stop(); canvas.stop();
if (! /__debug__$/i.test(document.location.href)) { if (Util.get_logging() !== 'debug') {
canvas.clear(); canvas.clear();
} }
} }
......
...@@ -59,7 +59,16 @@ Array.prototype.push32 = function (num) { ...@@ -59,7 +59,16 @@ Array.prototype.push32 = function (num) {
* Logging/debug routines * Logging/debug routines
*/ */
Util._log_level = 'warn';
Util.init_logging = function (level) { Util.init_logging = function (level) {
if (typeof level === 'undefined') {
Util._log_level = (document.location.href.match(
/logging=([A-Za-z0-9\._\-]*)/) ||
['', Util._log_level])[1];
level = Util._log_level;
} else {
Util._log_level = level;
}
if (typeof window.console === "undefined") { if (typeof window.console === "undefined") {
if (typeof window.opera !== "undefined") { if (typeof window.opera !== "undefined") {
window.console = { window.console = {
...@@ -86,10 +95,11 @@ Util.init_logging = function (level) { ...@@ -86,10 +95,11 @@ Util.init_logging = function (level) {
throw("invalid logging type '" + level + "'"); throw("invalid logging type '" + level + "'");
} }
}; };
Util.get_logging = function () {
return Util._log_level;
}
// Initialize logging level // Initialize logging level
Util.init_logging( (document.location.href.match( Util.init_logging();
/logging=([A-Za-z0-9\._\-]*)/) ||
['', 'warn'])[1] );
Util.dirObj = function (obj, depth, parent) { Util.dirObj = function (obj, depth, parent) {
var i, msg = "", val = ""; var i, msg = "", val = "";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment