smartdebug/ts/index.ts

26 lines
596 B
TypeScript
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:boolean = false;
2015-11-16 00:50:28 +00:00
var smartDebug = {
2015-11-15 19:35:13 +00:00
log: function(message:string){
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-28 21:48:41 +00:00
},
2015-11-15 19:35:13 +00:00
activate: function(debugArg:boolean){
debugActive = debugArg;
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;