Adding close function to Logging to free resources
This commit is contained in:
parent
590b0a9f13
commit
6864756573
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hibas123/logging",
|
"name": "@hibas123/logging",
|
||||||
"version": "2.0.0",
|
"version": "2.0.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "out/index.js",
|
"main": "out/index.js",
|
||||||
"types": "out/index.d.ts",
|
"types": "out/index.d.ts",
|
||||||
@ -26,4 +26,4 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hibas123/utils": "^2.0.5"
|
"@hibas123/utils": "^2.0.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -39,7 +39,7 @@ export class LoggingBase {
|
|||||||
|
|
||||||
private messageObservable = new Observable<Message>();
|
private messageObservable = new Observable<Message>();
|
||||||
protected _name: string;
|
protected _name: string;
|
||||||
|
|
||||||
get name() {
|
get name() {
|
||||||
return this._name;
|
return this._name;
|
||||||
}
|
}
|
||||||
@ -88,6 +88,10 @@ export class LoggingBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public close() {
|
||||||
|
this.adapter.forEach(adapter => adapter.close ? adapter.close() : undefined);
|
||||||
|
}
|
||||||
|
|
||||||
public waitForSetup() {
|
public waitForSetup() {
|
||||||
return Promise.all(this.adapter_init);
|
return Promise.all(this.adapter_init);
|
||||||
}
|
}
|
||||||
|
@ -114,4 +114,7 @@ export interface Adapter {
|
|||||||
|
|
||||||
flush(sync: true): void;
|
flush(sync: true): void;
|
||||||
flush(sync: false): void | Promise<void>;
|
flush(sync: false): void | Promise<void>;
|
||||||
|
|
||||||
|
|
||||||
|
close?(): void;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user