From 9d4e5216194bba553fbb959bdf0d3a82ee9bcd01 Mon Sep 17 00:00:00 2001 From: Fabian Stamm Date: Sat, 8 May 2021 22:53:12 +0200 Subject: [PATCH] Fix error with non existing close on adapter --- meta.json | 2 +- package.json | 2 +- src/base.ts | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/meta.json b/meta.json index ded23dc..242b95b 100644 --- a/meta.json +++ b/meta.json @@ -1,6 +1,6 @@ { "name": "logging", - "version": "3.0.5", + "version": "3.0.6", "description": "", "author": "Fabian Stamm ", "contributors": [], diff --git a/package.json b/package.json index 64c6bed..664a8b2 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/base.ts b/src/base.ts index 817462a..19efa33 100644 --- a/src/base.ts +++ b/src/base.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); } } - }); + } } }