Bind functions of Logging to this
This commit is contained in:
parent
eeed068ddd
commit
7d75f65dd3
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "logging",
|
"name": "logging",
|
||||||
"version": "3.0.4",
|
"version": "3.0.5",
|
||||||
"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.4",
|
"version": "3.0.5",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "out/index.js",
|
"main": "out/index.js",
|
||||||
"types": "out/index.d.ts",
|
"types": "out/index.d.ts",
|
||||||
|
12
src/base.ts
12
src/base.ts
@ -74,6 +74,12 @@ export abstract class LoggingInterface implements ILoggingInterface {
|
|||||||
|
|
||||||
constructor(names: string[]) {
|
constructor(names: string[]) {
|
||||||
this.#names = names;
|
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[]) {
|
debug(...message: any[]) {
|
||||||
@ -193,12 +199,6 @@ export class LoggingBase extends LoggingInterface {
|
|||||||
if (options.console) {
|
if (options.console) {
|
||||||
this.addAdapter(consoleAdapter);
|
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) {
|
async addAdapter(adapter: Adapter) {
|
||||||
|
Loading…
Reference in New Issue
Block a user