File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff 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 ( ) ;
You can’t perform that action at this time.
0 commit comments