public final class HttpLoggingInterceptor extends Object implements okhttp3.Interceptor
The log levels written are as follows:
DEBUG: Logs request and response lines and their respective headers and bodies (if present).
--> POST /greeting http/1.1
Host: example.com
Content-Type: plain/text
Content-Length: 3
Hi?
--> END POST
<-- 200 OK (22ms)
Content-Type: plain/text
Content-Length: 6
Hello!
<-- END HTTP
INFO: Logs request and response lines and their respective headers and bodies (if present).
--> POST /greeting http/1.1
Host: example.com
Content-Type: plain/text
Content-Length: 3
--> END POST
<-- 200 OK (22ms)
Content-Type: plain/text
Content-Length: 6
<-- END HTTP
Other log levels, such as WARN and ERROR, are ignored.
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_LOGGER_NAME |
| Constructor and Description |
|---|
HttpLoggingInterceptor() |
HttpLoggingInterceptor(org.slf4j.Logger logger) |
public static final String DEFAULT_LOGGER_NAME
public HttpLoggingInterceptor()
public HttpLoggingInterceptor(org.slf4j.Logger logger)
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain)
throws IOException
intercept in interface okhttp3.InterceptorIOExceptionCopyright © 2017. All rights reserved.