Skip to content

Commit 197979f

Browse files
Fixed: Ensure custom log level doesn't log if its off or null
1 parent bc779d2 commit 197979f

File tree

1 file changed

+1
-0
lines changed
  • termux-shared/src/main/java/com/termux/shared/logger

1 file changed

+1
-0
lines changed

termux-shared/src/main/java/com/termux/shared/logger/Logger.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ public static boolean isLogLevelValid(Integer logLevel) {
439439
/** Check if custom log level is valid and >= {@link #CURRENT_LOG_LEVEL}. If custom log level is
440440
* not valid then {@link #LOG_LEVEL_VERBOSE} must be >= {@link #CURRENT_LOG_LEVEL}. */
441441
public static boolean shouldEnableLoggingForCustomLogLevel(Integer customLogLevel) {
442+
if (customLogLevel == null || CURRENT_LOG_LEVEL == LOG_LEVEL_OFF) return false;
442443
customLogLevel = Logger.isLogLevelValid(customLogLevel) ? customLogLevel: Logger.LOG_LEVEL_VERBOSE;
443444
return (customLogLevel >= CURRENT_LOG_LEVEL);
444445
}

0 commit comments

Comments
 (0)