add topic oriented debugging selection
This commit is contained in:
		
							
								
								
									
										1
									
								
								dist/index.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								dist/index.d.ts
									
									
									
									
										vendored
									
									
								
							@@ -1,5 +1,6 @@
 | 
				
			|||||||
export declare class SmartDebug {
 | 
					export declare class SmartDebug {
 | 
				
			||||||
    private _debugEnabled;
 | 
					    private _debugEnabled;
 | 
				
			||||||
 | 
					    constructor(debugTopic?: string);
 | 
				
			||||||
    readonly debugEnabled: boolean;
 | 
					    readonly debugEnabled: boolean;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * enables debugging output
 | 
					     * enables debugging output
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										9
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							@@ -1,8 +1,12 @@
 | 
				
			|||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
class SmartDebug {
 | 
					class SmartDebug {
 | 
				
			||||||
    constructor() {
 | 
					    constructor(debugTopic) {
 | 
				
			||||||
        this._debugEnabled = false;
 | 
					        this._debugEnabled = false;
 | 
				
			||||||
 | 
					        if (process.env.SMARTDEBUG === 'true' ||
 | 
				
			||||||
 | 
					            (debugTopic && process.env.SMARTDEBUG_TOPIC === debugTopic)) {
 | 
				
			||||||
 | 
					            this.enableDebugging();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    get debugEnabled() {
 | 
					    get debugEnabled() {
 | 
				
			||||||
        return this._debugEnabled;
 | 
					        return this._debugEnabled;
 | 
				
			||||||
@@ -11,6 +15,7 @@ class SmartDebug {
 | 
				
			|||||||
     * enables debugging output
 | 
					     * enables debugging output
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    enableDebugging() {
 | 
					    enableDebugging() {
 | 
				
			||||||
 | 
					        console.log('Enabled Debugging!');
 | 
				
			||||||
        this._debugEnabled = true;
 | 
					        this._debugEnabled = true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@@ -36,4 +41,4 @@ class SmartDebug {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
exports.SmartDebug = SmartDebug;
 | 
					exports.SmartDebug = SmartDebug;
 | 
				
			||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUVBO0lBQUE7UUFDVSxrQkFBYSxHQUFZLEtBQUssQ0FBQztJQW1DekMsQ0FBQztJQWxDQyxJQUFJLFlBQVk7UUFDZCxPQUFPLElBQUksQ0FBQyxhQUFhLENBQUM7SUFDNUIsQ0FBQztJQUVEOztPQUVHO0lBQ0ksZUFBZTtRQUNwQixJQUFJLENBQUMsYUFBYSxHQUFHLElBQUksQ0FBQztJQUM1QixDQUFDO0lBRUQ7O09BRUc7SUFDSSxnQkFBZ0I7UUFDckIsSUFBSSxDQUFDLGFBQWEsR0FBRyxLQUFLLENBQUM7SUFDN0IsQ0FBQztJQUVEOztPQUVHO0lBQ0ksR0FBRyxDQUFDLFNBQWM7UUFDdkIsSUFBSSxJQUFJLENBQUMsYUFBYSxFQUFFO1lBQ3RCLHNDQUFzQztZQUN0QyxPQUFPLENBQUMsR0FBRyxDQUFDLFNBQVMsQ0FBQyxDQUFDO1NBQ3hCO0lBQ0gsQ0FBQztJQUVEOztPQUVHO0lBQ0ksV0FBVztRQUNoQixPQUFPLElBQUksQ0FBQyxhQUFhLENBQUM7SUFDNUIsQ0FBQztDQUNGO0FBcENELGdDQW9DQyJ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 | 
				
			||||||
							
								
								
									
										16
									
								
								readme.md
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								readme.md
									
									
									
									
									
								
							@@ -1,13 +1,16 @@
 | 
				
			|||||||
# smartdebug
 | 
					# smartdebug
 | 
				
			||||||
 | 
					
 | 
				
			||||||
debug the smart way
 | 
					debug the smart way
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Availabililty
 | 
					## Availabililty
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[](https://www.npmjs.com/package/@pushrocks/smartdebug)
 | 
					[](https://www.npmjs.com/package/@pushrocks/smartdebug)
 | 
				
			||||||
[](https://GitLab.com/pushrocks/smartdebug)
 | 
					[](https://GitLab.com/pushrocks/smartdebug)
 | 
				
			||||||
[](https://github.com/pushrocks/smartdebug)
 | 
					[](https://github.com/pushrocks/smartdebug)
 | 
				
			||||||
[](https://pushrocks.gitlab.io/smartdebug/)
 | 
					[](https://pushrocks.gitlab.io/smartdebug/)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Status for master
 | 
					## Status for master
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[](https://GitLab.com/pushrocks/smartdebug/commits/master)
 | 
					[](https://GitLab.com/pushrocks/smartdebug/commits/master)
 | 
				
			||||||
[](https://GitLab.com/pushrocks/smartdebug/commits/master)
 | 
					[](https://GitLab.com/pushrocks/smartdebug/commits/master)
 | 
				
			||||||
[](https://www.npmjs.com/package/@pushrocks/smartdebug)
 | 
					[](https://www.npmjs.com/package/@pushrocks/smartdebug)
 | 
				
			||||||
@@ -19,23 +22,24 @@ debug the smart way
 | 
				
			|||||||
[](http://standardjs.com/)
 | 
					[](http://standardjs.com/)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Usage
 | 
					## Usage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Use TypeScript for best in class instellisense.
 | 
					Use TypeScript for best in class instellisense.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```typescript
 | 
					```typescript
 | 
				
			||||||
import * as smartdebug from '@pushrocks/smartdebug';
 | 
					import * as smartdebug from '@pushrocks/smartdebug';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
smartdebug.log('a cool message') // won't log
 | 
					smartdebug.log('a cool message'); // won't log
 | 
				
			||||||
smartdebug.enableDebugging();
 | 
					smartdebug.enableDebugging();
 | 
				
			||||||
smartdebug.log('another cool message') // this message will log
 | 
					smartdebug.log('another cool message'); // this message will log
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if(smartdebug.debugEnabled) {
 | 
					if (smartdebug.debugEnabled) {
 | 
				
			||||||
  console.log('Hi there!') // will also log since debugging is enabled
 | 
					  console.log('Hi there!'); // will also log since debugging is enabled
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
For further information read the linked docs at the top of this README.
 | 
					For further information read the linked docs at the top of this README.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
>  licensed | **©** [Lossless GmbH](https://lossless.gmbh)
 | 
					> licensed | **©** [Lossless GmbH](https://lossless.gmbh)
 | 
				
			||||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
 | 
					> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[](https://push.rocks)
 | 
					[](https://push.rocks)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,3 +1,4 @@
 | 
				
			|||||||
 | 
					// tslint:disable-next-line:no-implicit-dependencies
 | 
				
			||||||
import { expect, tap } from 'tapbundle';
 | 
					import { expect, tap } from 'tapbundle';
 | 
				
			||||||
import * as smartdebug from '../ts/index';
 | 
					import * as smartdebug from '../ts/index';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										13
									
								
								ts/index.ts
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								ts/index.ts
									
									
									
									
									
								
							@@ -2,7 +2,17 @@ import * as plugins from './smartdebug.plugins';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export class SmartDebug {
 | 
					export class SmartDebug {
 | 
				
			||||||
  private _debugEnabled: boolean = false;
 | 
					  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;
 | 
					    return this._debugEnabled;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -10,6 +20,7 @@ export class SmartDebug {
 | 
				
			|||||||
   * enables debugging output
 | 
					   * enables debugging output
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
  public enableDebugging() {
 | 
					  public enableDebugging() {
 | 
				
			||||||
 | 
					    console.log('Enabled Debugging!');
 | 
				
			||||||
    this._debugEnabled = true;
 | 
					    this._debugEnabled = true;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user