Merge pull request #423 from sergey-davydov/donotformateventdata

Add condition to log only if fine level is loggable
This commit is contained in:
Naoyuki Kanezawa
2017-07-14 11:25:20 +09:00
committed by GitHub
4 changed files with 46 additions and 15 deletions

View File

@@ -6,6 +6,7 @@ import okhttp3.Call;
import okhttp3.OkHttpClient;
import okhttp3.WebSocket;
import java.util.logging.Level;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
import java.net.URI;
@@ -75,11 +76,15 @@ public class IO {
Manager io;
if (newConnection) {
logger.fine(String.format("ignoring socket cache for %s", source));
if (logger.isLoggable(Level.FINE)) {
logger.fine(String.format("ignoring socket cache for %s", source));
}
io = new Manager(source, opts);
} else {
if (!managers.containsKey(id)) {
logger.fine(String.format("new io instance for %s", source));
if (logger.isLoggable(Level.FINE)) {
logger.fine(String.format("new io instance for %s", source));
}
managers.putIfAbsent(id, new Manager(source, opts));
}
io = managers.get(id);