Skip to content

Commit

Permalink
Fixes logger regression
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed Nov 21, 2023
1 parent ff8d6d8 commit 8bc5177
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/system/decorators/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ export function log<T extends (...arg: any) => any>(options?: LogOptions<T>, 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<string, any>) => {
let fn: Function | undefined;
Expand All @@ -97,12 +99,11 @@ export function log<T extends (...arg: any) => any>(options?: LogOptions<T>, 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<T>) {
if (!debugging && !Logger.enabled(debug ? 'debug' : 'info')) {
return;
if (!debugging && !Logger.enabled(logLevel)) {
return fn!.apply(this, args);
}

const scopeId = getNextLogScopeId();
Expand Down

0 comments on commit 8bc5177

Please sign in to comment.