/**
 * Copyright: (c) 2016 Max Klein
 * License: MIT
 */

var Logger = (function (window, document) {
	"use strict";

	var console = window.console;
	var concat = Array.prototype.concat;

	function Logger(name) {
		this.name = name;
	}

	Logger.prototype._call = function (thisArg, fn, args) {
		var prefix = this.name ? ["[" + this.name + "]"] : [];
		var allArgs = concat.apply(prefix, args);
		fn.apply(thisArg, allArgs);
	};

	Logger.prototype.debug = function () {
		this._call(console, console.log, arguments);
	};

	Logger.prototype.info = function () {
		this._call(console, console.info, arguments);
	};

	Logger.prototype.warn = function () {
		this._call(console, console.warn, arguments);
	};

	Logger.prototype.error = function () {
		this._call(console, console.error, arguments);
	};

	return Logger;
})(window, document);

@@ -181,16 +181,145 @@
 oncat;%0A%0A
+%09var enabledGlobally = true,%0A%09%09globalLevel = 0;%0A%0A%09var levelIndices = %7B%0A%09%09%22debug%22: 0,%0A%09%09%22info%22: 1,%0A%09%09%22warn%22: 2,%0A%09%09%22error%22: 3%0A%09%7D;%0A%0A
 %09functio
@@ -331,16 +331,32 @@
 ger(name
+, enabled, level
 ) %7B%0A%09%09th
@@ -371,16 +371,129 @@
 = name;%0A
+%09%09this.enabled = enabled !== false;%0A%09%09this.level = levelIndices.hasOwnProperty(level) ? levelIndices%5Blevel%5D : 0;%0A
 %09%7D%0A%0A%09Log
@@ -699,21 +699,164 @@
 ototype.
-debug
+enable = function () %7B%0A%09%09this.enabled = true;%0A%09%7D;%0A%0A%09Logger.prototype.disable = function () %7B%0A%09%09this.enabled = false;%0A%09%7D;%0A%0A%09Logger.prototype.setLevel
  = funct
@@ -852,36 +852,253 @@
 vel = function (
+level
 ) %7B%0A
+%09%09if(levelIndices.hasOwnProperty(level)) %7B%0A%09%09%09this.level = levelIndices%5Blevel%5D;%0A%09%09%7D%0A%09%7D;%0A%0A%09Logger.prototype.debug = function () %7B%0A%09%09if(enabledGlobally && this.enabled &&%0A%09%09%09globalLevel %3C= 0 && this.level %3C= 0) %7B%0A%09
 %09%09this._call(con
@@ -1120,32 +1120,36 @@
 og, arguments);%0A
+%09%09%7D%0A
 %09%7D;%0A%0A%09Logger.pro
@@ -1168,32 +1168,115 @@
 = function () %7B%0A
+%09%09if(enabledGlobally && this.enabled &&%0A%09%09%09globalLevel %3C= 1 && this.level %3C= 1) %7B%0A%09
 %09%09this._call(con
@@ -1299,32 +1299,36 @@
 fo, arguments);%0A
+%09%09%7D%0A
 %09%7D;%0A%0A%09Logger.pro
@@ -1347,32 +1347,115 @@
 = function () %7B%0A
+%09%09if(enabledGlobally && this.enabled &&%0A%09%09%09globalLevel %3C= 2 && this.level %3C= 2) %7B%0A%09
 %09%09this._call(con
@@ -1482,24 +1482,28 @@
 arguments);%0A
+%09%09%7D%0A
 %09%7D;%0A%0A%09Logger
@@ -1541,54 +1541,395 @@
 %7B%0A%09%09
-this._call(console, console.error, arguments);
+if(enabledGlobally && this.enabled &&%0A%09%09%09globalLevel %3C= 3 && this.level %3C= 3) %7B%0A%09%09%09this._call(console, console.error, arguments);%0A%09%09%7D%0A%09%7D;%0A%0A%09Logger.enable = function () %7B%0A%09%09enabledGlobally = true;%0A%09%7D;%0A%0A%09Logger.disable = function () %7B%0A%09%09enabledGlobally = false;%0A%09%7D;%0A%0A%09Logger.setLevel = function (level) %7B%0A%09%09if(levelIndices.hasOwnProperty(level)) %7B%0A%09%09%09globalLevel = levelIndices%5Blevel%5D;%0A%09%09%7D
 %0A%09%7D;

Support for disabling and setting visible logging levels