From 8bc51778f0698ef7674847b637a56d678cabab39 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Tue, 21 Nov 2023 10:42:54 -0500 Subject: [PATCH] Fixes logger regression --- src/system/decorators/log.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/system/decorators/log.ts b/src/system/decorators/log.ts index 7667669..1ef8b4e 100644 --- a/src/system/decorators/log.ts +++ b/src/system/decorators/log.ts @@ -83,7 +83,9 @@ export function log any>(options?: LogOptions, deb scoped = true; } + const debugging = Logger.isDebugging; const logFn: (message: string, ...params: any[]) => void = debug ? Logger.debug : Logger.log; + const logLevel = debugging ? 'debug' : 'info'; return (target: any, key: string, descriptor: PropertyDescriptor & Record) => { let fn: Function | undefined; @@ -97,12 +99,11 @@ export function log any>(options?: LogOptions, deb } if (fn == null || fnKey == null) throw new Error('Not supported'); - const debugging = Logger.isDebugging; const parameters = overrides !== false ? getParameters(fn) : []; descriptor[fnKey] = function (this: any, ...args: Parameters) { - if (!debugging && !Logger.enabled(debug ? 'debug' : 'info')) { - return; + if (!debugging && !Logger.enabled(logLevel)) { + return fn!.apply(this, args); } const scopeId = getNextLogScopeId();