diff --git a/package-lock.json b/package-lock.json index 3ad577a..4cab298 100644 --- a/package-lock.json +++ b/package-lock.json @@ -795,8 +795,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -817,14 +816,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -839,20 +836,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -969,8 +963,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -982,7 +975,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -997,7 +989,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -1005,14 +996,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -1031,7 +1020,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -1112,8 +1100,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -1125,7 +1112,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -1211,8 +1197,7 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -1248,7 +1233,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -1268,7 +1252,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -1312,14 +1295,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, diff --git a/src/base.ts b/src/base.ts index bc7d238..3f7e125 100644 --- a/src/base.ts +++ b/src/base.ts @@ -38,7 +38,11 @@ export class LoggingBase { private adapter_init: Promise[] = []; private messageObservable = new Observable(); - protected name: string; + protected _name: string; + + get name() { + return this._name; + } constructor(options?: Partial | string) { let opt: Partial; @@ -57,7 +61,7 @@ export class LoggingBase { }; if (config.name) - this.name = config.name; + this._name = config.name; for (let key in this) { if (typeof this[key] === "function") this[key] = (this[key]).bind(this); @@ -70,7 +74,7 @@ export class LoggingBase { addAdapter(adapter: Adapter) { this.adapter.push(adapter); - let prms = Promise.resolve(adapter.init(this.messageObservable.getPublicApi(), this.name)); + let prms = Promise.resolve(adapter.init(this.messageObservable.getPublicApi(), this._name)); this.adapter_init.push(prms); } @@ -186,7 +190,7 @@ export class LoggingBase { let msg: Message = { date: new Date(), file, - name: this.name, + name: this._name, text: { raw: lines, formatted