Fix error with non existing close on adapter

This commit is contained in:
Fabian Stamm 2021-05-08 22:53:12 +02:00
parent 7d75f65dd3
commit 9d4e521619
3 changed files with 5 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{
"name": "logging",
"version": "3.0.5",
"version": "3.0.6",
"description": "",
"author": "Fabian Stamm <dev@fabianstamm.de>",
"contributors": [],

View File

@ -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",

View File

@ -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);
}
}
});
}
}
}