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