add topic oriented debugging selection

This commit is contained in:
2018-04-12 19:29:24 +02:00
parent 4cb7b82e0b
commit 9c01368fe9
6 changed files with 33 additions and 11 deletions

View File

@ -2,7 +2,17 @@ import * as plugins from './smartdebug.plugins';
export class SmartDebug {
private _debugEnabled: boolean = false;
get debugEnabled () {
constructor(debugTopic?: string) {
if (
process.env.SMARTDEBUG === 'true' ||
(debugTopic && process.env.SMARTDEBUG_TOPIC === debugTopic)
) {
this.enableDebugging();
}
}
get debugEnabled() {
return this._debugEnabled;
}
@ -10,6 +20,7 @@ export class SmartDebug {
* enables debugging output
*/
public enableDebugging() {
console.log('Enabled Debugging!');
this._debugEnabled = true;
}
@ -31,7 +42,7 @@ export class SmartDebug {
}
/**
* a function returning
* a function returning
*/
public isDebugMode() {
return this._debugEnabled;

View File

@ -1 +1 @@
export {};
export {};