Skip to content
This repository has been archived by the owner on Feb 25, 2019. It is now read-only.

Commit

Permalink
Support custom logger
Browse files Browse the repository at this point in the history
  • Loading branch information
msdx committed Sep 29, 2017
1 parent 77936fd commit b07b210
Showing 1 changed file with 16 additions and 8 deletions.
Expand Up @@ -24,16 +24,24 @@
import okio.BufferedSource;

public class LogInterceptor implements Interceptor {
private static final Charset UTF8 = Charset.forName("UTF-8");

private static final Charset UTF8 = Charset.forName("UTF-8");
private static final AtomicInteger ID_GENERATOR = new AtomicInteger(0);

private final Logger logger = new Logger() {
@Override
public void log(String message) {
Platform.get().log(Platform.WARN, message, null);
}
};
private final Logger logger;

public LogInterceptor() {
this(new Logger() {
@Override
public void log(String message) {
Platform.get().log(Platform.WARN, message, null);
}
});
}

public LogInterceptor(Logger logger) {
this.logger = logger;
}

@Override
public Response intercept(Chain chain) throws IOException {
Expand Down Expand Up @@ -185,7 +193,7 @@ private boolean bodyEncoded(Headers headers) {
return contentEncoding != null && !contentEncoding.equalsIgnoreCase("identity");
}

interface Logger {
public interface Logger {
void log(String message);
}
}

0 comments on commit b07b210

Please sign in to comment.