Skip to content

Instantly share code, notes, and snippets.

@xymostech
Last active December 29, 2015 05:29
Show Gist options
  • Save xymostech/7622238 to your computer and use it in GitHub Desktop.
Save xymostech/7622238 to your computer and use it in GitHub Desktop.
(function() {
var streams = {};
function Stream() {
this.enabled = true;
};
Stream.prototype.log = function() {
if (this.enabled) {
window.console.log.apply(window.console, Array.prototype.slice.call(arguments, 0));
}
};
window.console.stream = function(name) {
if (!streams[name]) {
streams[name] = new Stream();
}
return streams[name];
};
window.console.on = function(name) {
streams[name].enabled = true;
};
window.console.off = function(name) {
streams[name].enabled = false;
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment