8 Commits

Author SHA1 Message Date
a8b760165d 2.0.5 2017-09-18 19:11:37 +02:00
b65c012779 fi ci 2017-09-18 19:11:34 +02:00
657f07120c 2.0.4 2017-09-18 19:10:29 +02:00
919a23cd09 test yml behaviour 2017-09-18 19:10:21 +02:00
d5a4a0f4ee 2.0.3 2017-09-18 18:22:50 +02:00
9e3ed92604 2.0.2 2017-09-18 17:53:28 +02:00
4dea1cfac2 now accepts third party debug function 2017-09-18 17:53:23 +02:00
8ab8a4f18b 2.0.1 2017-09-18 15:30:41 +02:00
4 changed files with 17 additions and 7 deletions

3
dist/index.d.ts vendored
View File

@@ -1,9 +1,10 @@
export declare class SmartDebug { export declare class SmartDebug {
debugLogFunction: any;
private debugEnabled; private debugEnabled;
/** /**
* enables debugging output * enables debugging output
*/ */
enableDebugging(): void; enableDebugging(debugLogFunction?: any): void;
/** /**
* logs a message based on the contraints of the SmartDebug instance * logs a message based on the contraints of the SmartDebug instance
*/ */

11
dist/index.js vendored
View File

@@ -2,22 +2,27 @@
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
class SmartDebug { class SmartDebug {
constructor() { constructor() {
this.debugLogFunction = null;
this.debugEnabled = false; this.debugEnabled = false;
} }
/** /**
* enables debugging output * enables debugging output
*/ */
enableDebugging() { enableDebugging(debugLogFunction = null) {
this.debugEnabled = true; this.debugEnabled = true;
this.debugLogFunction = debugLogFunction;
} }
/** /**
* logs a message based on the contraints of the SmartDebug instance * logs a message based on the contraints of the SmartDebug instance
*/ */
log(logObject) { log(logObject) {
if (this.debugEnabled) { if (this.debugEnabled && this.debugLogFunction) {
this.debugLogFunction(logObject);
}
else if (this.debugEnabled) {
console.log(logObject); console.log(logObject);
} }
} }
} }
exports.SmartDebug = SmartDebug; exports.SmartDebug = SmartDebug;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIu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QyxDQUFDO1FBQUMsSUFBSSxDQUFDLEVBQUUsQ0FBQyxDQUFDLElBQUksQ0FBQyxZQUFZLENBQUMsQ0FBQyxDQUFDO1lBQzdCLE9BQU8sQ0FBQyxHQUFHLENBQUMsU0FBUyxDQUFDLENBQUE7UUFDeEIsQ0FBQztJQUNILENBQUM7Q0FFRjtBQXZCRCxnQ0F1QkMifQ==

View File

@@ -1,6 +1,6 @@
{ {
"name": "smartdebug", "name": "smartdebug",
"version": "2.0.0", "version": "2.0.5",
"description": "debug the smart way", "description": "debug the smart way",
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts", "typings": "dist/index.d.ts",

View File

@@ -1,20 +1,24 @@
import * as plugins from './smartdebug.plugins' import * as plugins from './smartdebug.plugins'
export class SmartDebug { export class SmartDebug {
debugLogFunction: any = null
private debugEnabled: boolean = false private debugEnabled: boolean = false
/** /**
* enables debugging output * enables debugging output
*/ */
enableDebugging () { enableDebugging (debugLogFunction = null) {
this.debugEnabled = true this.debugEnabled = true
this.debugLogFunction = debugLogFunction
} }
/** /**
* logs a message based on the contraints of the SmartDebug instance * logs a message based on the contraints of the SmartDebug instance
*/ */
log (logObject: any) { log (logObject: any) {
if (this.debugEnabled) { if (this.debugEnabled && this.debugLogFunction) {
this.debugLogFunction(logObject)
} else if (this.debugEnabled) {
console.log(logObject) console.log(logObject)
} }
} }