smartdebug/index.js

25 lines
701 B
JavaScript
Raw Normal View History

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;
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;