2015-11-15 19:35:13 +00:00
|
|
|
/// <reference path="typings/tsd.d.ts" />
|
2015-11-16 00:50:28 +00:00
|
|
|
var beautylog = require("beautylog")("os");
|
2015-11-15 19:35:13 +00:00
|
|
|
var colors = require("colors");
|
|
|
|
var debugActive = false;
|
2015-11-16 00:50:28 +00:00
|
|
|
var smartDebug = {
|
2015-11-15 19:35:13 +00:00
|
|
|
log: function (message) {
|
|
|
|
if (debugActive) {
|
2015-11-16 00:50:28 +00:00
|
|
|
beautylog.log("###DEBUG:###".rainbow + ' ' + message);
|
2015-11-15 19:35:13 +00:00
|
|
|
}
|
|
|
|
},
|
2015-11-28 21:43:57 +00:00
|
|
|
run: function (functionArg) {
|
|
|
|
if (debugActive) {
|
|
|
|
functionArg();
|
|
|
|
}
|
|
|
|
},
|
2015-11-15 19:35:13 +00:00
|
|
|
activate: function (debugArg) {
|
|
|
|
debugActive = debugArg;
|
2015-12-02 13:01:47 +00:00
|
|
|
beautylog.log("#### ".rainbow + "!!! ".red + "Debugging has been activated!".blue + " !!!".red + " ####".rainbow);
|
2015-11-22 06:59:34 +00:00
|
|
|
},
|
|
|
|
getStatus: function () {
|
|
|
|
return debugActive;
|
2015-11-15 19:35:13 +00:00
|
|
|
}
|
|
|
|
};
|
2015-11-16 00:50:28 +00:00
|
|
|
module.exports = smartDebug;
|