public final class HttpLoggingInterceptor extends java.lang.Object implements Interceptor
The format of the logs created by this class should not be considered stable and may change slightly between releases. If you need a stable logging format, use your own interceptor.
Modifier and Type | Class and Description |
---|---|
static class |
HttpLoggingInterceptor.Level |
static interface |
HttpLoggingInterceptor.Logger |
Interceptor.Chain
Modifier and Type | Field and Description |
---|---|
private java.util.Set<java.lang.String> |
headersToRedact |
private HttpLoggingInterceptor.Level |
level |
private HttpLoggingInterceptor.Logger |
logger |
private static java.nio.charset.Charset |
UTF8 |
Constructor and Description |
---|
HttpLoggingInterceptor() |
HttpLoggingInterceptor(HttpLoggingInterceptor.Logger logger) |
Modifier and Type | Method and Description |
---|---|
private static boolean |
bodyHasUnknownEncoding(Headers headers) |
HttpLoggingInterceptor.Level |
getLevel() |
Response |
intercept(Interceptor.Chain chain) |
(package private) static boolean |
isPlaintext(okio.Buffer buffer)
Returns true if the body in question probably contains human readable text.
|
private void |
logHeader(Headers headers,
int i) |
void |
redactHeader(java.lang.String name) |
HttpLoggingInterceptor |
setLevel(HttpLoggingInterceptor.Level level)
Change the level at which this interceptor logs.
|
private static final java.nio.charset.Charset UTF8
private final HttpLoggingInterceptor.Logger logger
private volatile java.util.Set<java.lang.String> headersToRedact
private volatile HttpLoggingInterceptor.Level level
public HttpLoggingInterceptor()
public HttpLoggingInterceptor(HttpLoggingInterceptor.Logger logger)
public void redactHeader(java.lang.String name)
public HttpLoggingInterceptor setLevel(HttpLoggingInterceptor.Level level)
public HttpLoggingInterceptor.Level getLevel()
public Response intercept(Interceptor.Chain chain) throws java.io.IOException
intercept
in interface Interceptor
java.io.IOException
private void logHeader(Headers headers, int i)
static boolean isPlaintext(okio.Buffer buffer)
private static boolean bodyHasUnknownEncoding(Headers headers)