Skip to content

Commit 539031b

Browse files
committed
rename hasAddKeyValue to isSLF4J2x.
1 parent f611c74 commit 539031b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

gax-java/gax/src/main/java/com/google/api/gax/logging/Slf4jUtils.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,18 @@ class Slf4jUtils {
5454
private static boolean loggingEnabled = LoggingUtils.isLoggingEnabled();
5555
private static final Gson gson = new Gson();
5656

57-
private static boolean hasAddKeyValue;
57+
private static boolean isSLF4J2x;
5858

5959
static {
60-
hasAddKeyValue = checkIfClazzAvailable("org.slf4j.event.KeyValuePair");
60+
isSLF4J2x = checkIfClazzAvailable("org.slf4j.event.KeyValuePair");
6161
}
6262

6363
static boolean checkIfClazzAvailable(String clazzName) {
6464
try {
6565
Class.forName(clazzName);
66-
return true; // SLF4j 2.x or later
66+
return true;
6767
} catch (ClassNotFoundException e) {
68-
return false; // SLF4j 1.x or earlier
68+
return false;
6969
}
7070
}
7171

@@ -88,7 +88,7 @@ static Logger getLogger(Class<?> clazz, LoggerFactoryProvider factoryProvider) {
8888

8989
static void log(
9090
Logger logger, org.slf4j.event.Level level, Map<String, Object> contextMap, String message) {
91-
if (hasAddKeyValue) {
91+
if (isSLF4J2x) {
9292
logWithKeyValuePair(logger, level, contextMap, message);
9393
} else {
9494
logWithMDC(logger, level, contextMap, message);

0 commit comments

Comments
 (0)