smartdebug/index.js
2015-12-02 14:01:47 +01:00

25 lines
701 B
JavaScript

/// <reference path="typings/tsd.d.ts" />
var beautylog = require("beautylog")("os");
var colors = require("colors");
var debugActive = false;
var smartDebug = {
log: function (message) {
if (debugActive) {
beautylog.log("###DEBUG:###".rainbow + ' ' + message);
}
},
run: function (functionArg) {
if (debugActive) {
functionArg();
}
},
activate: function (debugArg) {
debugActive = debugArg;
beautylog.log("#### ".rainbow + "!!! ".red + "Debugging has been activated!".blue + " !!!".red + " ####".rainbow);
},
getStatus: function () {
return debugActive;
}
};
module.exports = smartDebug;