1
0
mirror of https://github.com/square/okhttp.git synced 2025-11-24 18:41:06 +03:00

Make logging more consistent throughout OkHttp.

Avoid using System.out.

Use the best logging implementation on the host platform. On Java this is
java.util.logging. On Android it's Android.util.Log.

Closes https://github.com/square/okhttp/issues/2505
This commit is contained in:
jwilson
2016-05-07 20:38:29 -04:00
parent 80ab4a3761
commit 4f24a30c12
13 changed files with 46 additions and 35 deletions

View File

@@ -35,6 +35,8 @@ import okhttp3.internal.http.HttpEngine;
import okio.Buffer;
import okio.BufferedSource;
import static okhttp3.internal.Platform.INFO;
/**
* An OkHttp interceptor which logs request and response information. Can be applied as an
* {@linkplain OkHttpClient#interceptors() application interceptor} or as a {@linkplain
@@ -107,7 +109,7 @@ public final class HttpLoggingInterceptor implements Interceptor {
/** A {@link Logger} defaults output appropriate for the current platform. */
Logger DEFAULT = new Logger() {
@Override public void log(String message) {
Platform.get().log(message);
Platform.get().log(INFO, message, null);
}
};
}