Merging
This commit is contained in:
12
src/base.ts
12
src/base.ts
@ -38,7 +38,11 @@ export class LoggingBase {
|
||||
private adapter_init: Promise<void>[] = [];
|
||||
|
||||
private messageObservable = new Observable<Message>();
|
||||
protected name: string;
|
||||
protected _name: string;
|
||||
|
||||
get name() {
|
||||
return this._name;
|
||||
}
|
||||
|
||||
constructor(options?: Partial<LoggingBaseOptions> | string) {
|
||||
let opt: Partial<LoggingBaseOptions>;
|
||||
@ -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] = (<any>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
|
||||
|
Reference in New Issue
Block a user