@@ -49,29 +49,28 @@ class ACL {
4949 */
5050 constructor ( config = { } ) {
5151 // Logging level settings
52- this . logLevel = config . logLevel || 1 ;
52+ this . logLevel = typeof config . logLevel === "number" ? config . logLevel : 1 ;
5353
5454 // File logging options
5555 this . outputFilename = config . outputFilename || null ;
56- this . outputFilenameLogLevel =
57- config . outputFilenameLogLevel || this . logLevel ;
56+ this . outputFilenameLogLevel = config . outputFilenameLogLevel ?? 1 ;
5857
5958 // Include timestamps in log messages
6059 this . includeTimestamps = config . includeTimestamps !== false ;
6160
6261 // Memory usage settings
6362 this . includeMemoryUsage = config . includeMemoryUsage || false ;
64- this . memoryCheckFrequency = config . memoryCheckFrequency || 10 ;
65- this . memoryDisplayMode = config . memoryDisplayMode || 1 ;
63+ this . memoryCheckFrequency = config . memoryCheckFrequency ?? 10 ; // Accept 0 values
64+ this . memoryDisplayMode = config . memoryDisplayMode ?? 1 ; // Accept 0 values
6665
6766 // Caller info settings
6867 this . includeCallerInfo = config . includeCallerInfo || false ;
69- this . callerInfoLevel = config . callerInfoLevel || 2 ; // Default to warn and above
70- this . callerInfoDisplayMode = config . callerInfoDisplayMode || 1 ;
68+ this . callerInfoLevel = config . callerInfoLevel ?? 2 ; // Accept 0 values
69+ this . callerInfoDisplayMode = config . callerInfoDisplayMode ?? 1 ; // Accept 0 values
7170
7271 // Inline caller info settings
7372 this . includeInlineCallerInfo = ! ! config . includeInlineCallerInfo ;
74- this . inlineCallerInfoLevel = config . inlineCallerInfoLevel || 1 ;
73+ this . inlineCallerInfoLevel = config . inlineCallerInfoLevel ?? 1 ; // Accept 0 values
7574
7675 // Include stack trace in error and fatal messages
7776 this . includeStackTrace = ! ! config . includeStackTrace ;
@@ -235,14 +234,17 @@ class ACL {
235234 * @returns {boolean } - Whether to log to console.
236235 */
237236 shouldLogToConsole ( condition , level ) {
237+ console . log ( this . logLevel , condition , level ) ;
238238 if (
239239 this . logLevel === 0 ||
240240 ( typeof condition === "boolean" && ! condition ) ||
241241 ( this . logLevel === 2 && level < 2 ) ||
242242 ( this . logLevel === 3 && level < 3 )
243243 ) {
244+ console . log ( "shouldLogToConsole" , "false" ) ;
244245 return false ;
245246 }
247+ console . log ( "shouldLogToConsole" , "true" ) ;
246248 return true ;
247249 }
248250
0 commit comments