This commit is contained in:
Erik 2023-11-15 22:18:25 +02:00
parent 44226e6a92
commit 38e7833385
2 changed files with 3 additions and 3 deletions

View File

@ -45,9 +45,9 @@ class LoggerClient implements Logger
if (typeof this.#_logLevelMapping[type] === 'undefined') if (typeof this.#_logLevelMapping[type] === 'undefined')
throw new Error(`Missing logLevelMapping for type ${type}`); throw new Error(`Missing logLevelMapping for type ${type}`);
Object.defineProperty(this, 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 ] }); this.#transport(msg, { ...writeOpts, type, labels: [ ...this.#labels, ...labels ] });
} }
}); });

View File

@ -85,7 +85,7 @@ class MasterLogger implements Logger
if (typeof this.#_logLevelMapping[type] === 'undefined') if (typeof this.#_logLevelMapping[type] === 'undefined')
throw new Error(`Missing logLevelMapping for type ${type}`); throw new Error(`Missing logLevelMapping for type ${type}`);
Object.defineProperty(this, 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 }; this.#colours = { ...Defaults.Colours, ...customColours };