smartdebug/dist/index.js

28 lines
1.6 KiB
JavaScript
Raw Normal View History

2017-09-18 13:19:18 +00:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class SmartDebug {
constructor() {
2017-09-18 15:53:23 +00:00
this.debugLogFunction = null;
2017-09-18 13:19:18 +00:00
this.debugEnabled = false;
}
/**
* enables debugging output
*/
2017-09-19 15:48:56 +00:00
enableDebugging(debugLogFunction = console.log) {
2017-09-18 13:19:18 +00:00
this.debugEnabled = true;
2017-09-18 15:53:23 +00:00
this.debugLogFunction = debugLogFunction;
2017-09-18 13:19:18 +00:00
}
/**
* logs a message based on the contraints of the SmartDebug instance
*/
log(logObject) {
2017-09-18 15:53:23 +00:00
if (this.debugEnabled && this.debugLogFunction) {
this.debugLogFunction(logObject);
}
else if (this.debugEnabled) {
2017-09-18 13:19:18 +00:00
console.log(logObject);
}
}
}
exports.SmartDebug = SmartDebug;
2017-09-19 15:48:56 +00:00
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUVBO0lBQUE7UUFDRSxxQkFBZ0IsR0FBUSxJQUFJLENBQUE7UUFDcEIsaUJBQVksR0FBWSxLQUFLLENBQUE7SUFxQnZDLENBQUM7SUFuQkM7O09BRUc7SUFDSCxlQUFlLENBQUUsZ0JBQWdCLEdBQUcsT0FBTyxDQUFDLEdBQUc7UUFDN0MsSUFBSSxDQUFDLFlBQVksR0FBRyxJQUFJLENBQUE7UUFDeEIsSUFBSSxDQUFDLGdCQUFnQixHQUFHLGdCQUFnQixDQUFBO0lBQzFDLENBQUM7SUFFRDs7T0FFRztJQUNILEdBQUcsQ0FBRSxTQUFjO1FBQ2pCLEVBQUUsQ0FBQyxDQUFDLElBQUksQ0FBQyxZQUFZLElBQUksSUFBSSxDQUFDLGdCQUFnQixDQUFDLENBQUMsQ0FBQztZQUMvQyxJQUFJLENBQUMsZ0JBQWdCLENBQUMsU0FBUyxDQUFDLENBQUE7UUFDbEMsQ0FBQztRQUFDLElBQUksQ0FBQyxFQUFFLENBQUMsQ0FBQyxJQUFJLENBQUMsWUFBWSxDQUFDLENBQUMsQ0FBQztZQUM3QixPQUFPLENBQUMsR0FBRyxDQUFDLFNBQVMsQ0FBQyxDQUFBO1FBQ3hCLENBQUM7SUFDSCxDQUFDO0NBRUY7QUF2QkQsZ0NBdUJDIn0=