All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.payu.sdk.api.http.interceptor.LoggingInterceptor Maven / Gradle / Ivy

The newest version!
package com.payu.sdk.api.http.interceptor;

import com.payu.sdk.api.log.ApiLog;
import com.squareup.okhttp.Interceptor;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import java.io.IOException;

import static com.payu.sdk.api.log.Logger.getLog;

public class LoggingInterceptor implements Interceptor {
  private static final ApiLog logger = getLog();

  @Override public Response intercept(Chain chain) throws IOException {
    Request request = chain.request();

    logger.log(String.format("Sending request headers %s", request.headers()));
    Response response = chain.proceed(request);
    logger.log(String.format("Received response with code: %s \n headers: \n %s", response.code(),
        response.headers()));

    return response;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy