add logging support to SDK API client (FINERACT-1216)
This commit is contained in:
committed by
Petri Tuomola
parent
9cf89d7193
commit
9b2d95f9bb
@@ -18,6 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.client.util;
|
||||
|
||||
import okhttp3.logging.HttpLoggingInterceptor;
|
||||
import okhttp3.logging.HttpLoggingInterceptor.Level;
|
||||
import org.apache.fineract.client.ApiClient;
|
||||
import org.apache.fineract.client.auth.ApiKeyAuth;
|
||||
import org.apache.fineract.client.auth.HttpBasicAuth;
|
||||
@@ -278,6 +280,13 @@ public class FineractClient {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder logging(Level level) {
|
||||
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
|
||||
logging.setLevel(level);
|
||||
getApiClient().getOkBuilder().addInterceptor(logging);
|
||||
return this;
|
||||
}
|
||||
|
||||
public FineractClient build() {
|
||||
// URL
|
||||
apiClient.getAdapterBuilder().baseUrl(has("baseURL", baseURL));
|
||||
|
||||
Reference in New Issue
Block a user