Skip to content

Commit 8bc5177

Browse files
committed
Fixes logger regression
1 parent ff8d6d8 commit 8bc5177

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/system/decorators/log.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ export function log<T extends (...arg: any) => any>(options?: LogOptions<T>, deb
8383
scoped = true;
8484
}
8585

86+
const debugging = Logger.isDebugging;
8687
const logFn: (message: string, ...params: any[]) => void = debug ? Logger.debug : Logger.log;
88+
const logLevel = debugging ? 'debug' : 'info';
8789

8890
return (target: any, key: string, descriptor: PropertyDescriptor & Record<string, any>) => {
8991
let fn: Function | undefined;
@@ -97,12 +99,11 @@ export function log<T extends (...arg: any) => any>(options?: LogOptions<T>, deb
9799
}
98100
if (fn == null || fnKey == null) throw new Error('Not supported');
99101

100-
const debugging = Logger.isDebugging;
101102
const parameters = overrides !== false ? getParameters(fn) : [];
102103

103104
descriptor[fnKey] = function (this: any, ...args: Parameters<T>) {
104-
if (!debugging && !Logger.enabled(debug ? 'debug' : 'info')) {
105-
return;
105+
if (!debugging && !Logger.enabled(logLevel)) {
106+
return fn!.apply(this, args);
106107
}
107108

108109
const scopeId = getNextLogScopeId();

0 commit comments

Comments
 (0)