diff --git a/package-lock.json b/package-lock.json index 47b996c..d40c844 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@hibas123/logging", - "version": "1.0.1", + "version": "1.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -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/package.json b/package.json index 3d14f9f..c4ed220 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hibas123/logging", - "version": "1.1.0", + "version": "1.1.1", "description": "", "main": "out/index.js", "types": "out/index.d.ts", @@ -26,4 +26,4 @@ "dependencies": { "@hibas123/utils": "^2.0.2" } -} \ No newline at end of file +} diff --git a/src/base.ts b/src/base.ts index acb5342..f2c64ce 100644 --- a/src/base.ts +++ b/src/base.ts @@ -44,13 +44,15 @@ export interface LoggingBaseOptions { } export class LoggingBase { - private logFile: any; - private errorFile: any; private adapter: Adapter[] = []; 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; @@ -69,7 +71,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); @@ -82,7 +84,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); } @@ -171,7 +173,7 @@ export class LoggingBase { let msg: Message = { date: new Date(), file, - name: this.name, + name: this._name, text: { raw: lines, formatted