From 7d75f65dd32db4a077f14d2b35e268c1f7d8b32e Mon Sep 17 00:00:00 2001 From: Fabian Stamm Date: Sat, 8 May 2021 22:28:06 +0200 Subject: [PATCH] Bind functions of Logging to this --- meta.json | 2 +- package.json | 2 +- src/base.ts | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/meta.json b/meta.json index 0fdf034..ded23dc 100644 --- a/meta.json +++ b/meta.json @@ -1,6 +1,6 @@ { "name": "logging", - "version": "3.0.4", + "version": "3.0.5", "description": "", "author": "Fabian Stamm ", "contributors": [], diff --git a/package.json b/package.json index 1e306b8..64c6bed 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hibas123/logging", - "version": "3.0.4", + "version": "3.0.5", "description": "", "main": "out/index.js", "types": "out/index.d.ts", diff --git a/src/base.ts b/src/base.ts index a730df7..817462a 100644 --- a/src/base.ts +++ b/src/base.ts @@ -74,6 +74,12 @@ export abstract class LoggingInterface implements ILoggingInterface { constructor(names: string[]) { this.#names = names; + + for (const key in this) { + if (typeof this[key] === "function") { + this[key] = ((this[key] as never) as Function).bind(this); + } + } } debug(...message: any[]) { @@ -193,12 +199,6 @@ export class LoggingBase extends LoggingInterface { if (options.console) { this.addAdapter(consoleAdapter); } - - for (const key in this) { - if (typeof this[key] === "function") { - this[key] = ((this[key] as never) as Function).bind(this); - } - } } async addAdapter(adapter: Adapter) {