Fix error with non existing close on adapter
This commit is contained in:
parent
7d75f65dd3
commit
9d4e521619
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "logging",
|
||||
"version": "3.0.5",
|
||||
"version": "3.0.6",
|
||||
"description": "",
|
||||
"author": "Fabian Stamm <dev@fabianstamm.de>",
|
||||
"contributors": [],
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hibas123/logging",
|
||||
"version": "3.0.5",
|
||||
"version": "3.0.6",
|
||||
"description": "",
|
||||
"main": "out/index.js",
|
||||
"types": "out/index.d.ts",
|
||||
|
@ -373,19 +373,19 @@ export class LoggingBase extends LoggingInterface {
|
||||
if (this.#closed) return;
|
||||
this.#closed = true;
|
||||
|
||||
this.#adapters.forEach((adapter) => {
|
||||
for (const adapter of this.#adapters) {
|
||||
const cnt = LoggingBase[InitialisedAdapters].get(adapter);
|
||||
if (!cnt) {
|
||||
//TODO: should not happen!
|
||||
} else {
|
||||
if (cnt <= 1) {
|
||||
adapter.close();
|
||||
if (adapter.close) await adapter.close();
|
||||
LoggingBase[InitialisedAdapters].delete(adapter);
|
||||
} else {
|
||||
LoggingBase[InitialisedAdapters].set(adapter, cnt - 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user