Skip to content

Commit

Permalink
fix: revert old tricky behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
NiccoMlt committed Nov 20, 2024
1 parent 10ea9a7 commit 95f20cc
Showing 1 changed file with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
package org.carapaceproxy.utils;

import org.slf4j.LoggerFactory;
import org.slf4j.event.Level;

/**
*
* @author paolo.venturi
*/
public final class CarapaceLogger {
Expand All @@ -31,7 +31,8 @@ public final class CarapaceLogger {

private static boolean loggingDebugEnabled = false;

private CarapaceLogger() {}
private CarapaceLogger() {
}

public static boolean isLoggingDebugEnabled() {
return loggingDebugEnabled;
Expand All @@ -41,11 +42,15 @@ public static void setLoggingDebugEnabled(boolean loggingDebugEnabled) {
CarapaceLogger.loggingDebugEnabled = loggingDebugEnabled;
}

public static void debug(String s, Object ... o) {
if (loggingDebugEnabled) {
LOG.debug(s, o);
} else {
LOG.info(s, o);
}
/**
* This method assumes that {@link Level#DEBUG debug log level} is disabled.
* If {@link #setLoggingDebugEnabled(boolean) Carapace log level was enabled},
* forwards the log event to the {@link Level#INFO info log level} instead of using the debug level.
*
* @param s the format string
* @param o a list of arguments
*/
public static void debug(String s, Object... o) {
(loggingDebugEnabled ? LOG.atInfo() : LOG.atDebug()).log(s, o);
}
}

0 comments on commit 95f20cc

Please sign in to comment.