From 38e78333855b0592609cf61569f6cd682e669d5f Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Wed, 15 Nov 2023 22:18:25 +0200 Subject: [PATCH] bugfix --- src/LoggerClient.ts | 4 ++-- src/MasterLogger.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/LoggerClient.ts b/src/LoggerClient.ts index e2a6992..c0ba04f 100644 --- a/src/LoggerClient.ts +++ b/src/LoggerClient.ts @@ -45,9 +45,9 @@ class LoggerClient implements Logger if (typeof this.#_logLevelMapping[type] === 'undefined') throw new Error(`Missing logLevelMapping for type ${type}`); Object.defineProperty(this, type, { - value: (msg: string, o: WriteOptions) => + value: (msg: string, o?: WriteOptions) => { - const { labels = [], ...writeOpts } = o; + const { labels = [], ...writeOpts } = o ?? {}; this.#transport(msg, { ...writeOpts, type, labels: [ ...this.#labels, ...labels ] }); } }); diff --git a/src/MasterLogger.ts b/src/MasterLogger.ts index c2a998c..24f44c1 100644 --- a/src/MasterLogger.ts +++ b/src/MasterLogger.ts @@ -85,7 +85,7 @@ class MasterLogger implements Logger if (typeof this.#_logLevelMapping[type] === 'undefined') throw new Error(`Missing logLevelMapping for type ${type}`); Object.defineProperty(this, type, { - value: (msg: string, opts: WriteOptions) => this.write(type, msg, opts) + value: (msg: string, opts?: WriteOptions) => this.write(type, msg, opts) }); } this.#colours = { ...Defaults.Colours, ...customColours };