From d05d8efcc2dbe6a926f78beb9eceb4f982e92111 Mon Sep 17 00:00:00 2001 From: Alva Swanson Date: Fri, 4 Nov 2022 17:05:17 +0100 Subject: [PATCH] JsonRpcClient: Pretty log full request and response --- .../src/main/java/bisq/wallets/json_rpc/JsonRpcClient.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wallets/json-rpc/src/main/java/bisq/wallets/json_rpc/JsonRpcClient.java b/wallets/json-rpc/src/main/java/bisq/wallets/json_rpc/JsonRpcClient.java index e715edfc4c..567d48a36b 100644 --- a/wallets/json-rpc/src/main/java/bisq/wallets/json_rpc/JsonRpcClient.java +++ b/wallets/json-rpc/src/main/java/bisq/wallets/json_rpc/JsonRpcClient.java @@ -19,12 +19,14 @@ import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; +import lombok.extern.slf4j.Slf4j; import okhttp3.*; import okhttp3.logging.HttpLoggingInterceptor; import java.io.IOException; import java.util.Objects; +@Slf4j public class JsonRpcClient { public static final String AUTHORIZATION_HEADER_NAME = "Authorization"; @@ -40,8 +42,9 @@ public class JsonRpcClient { public JsonRpcClient(JsonRpcEndpointSpec rpcEndpointSpec) { this.rpcEndpointSpec = rpcEndpointSpec; - var loggingInterceptor = new HttpLoggingInterceptor(); - loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BASIC); + var loggingInterceptor = new HttpLoggingInterceptor(log::info); + loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY); + loggingInterceptor.redactHeader(AUTHORIZATION_HEADER_NAME); this.client = new OkHttpClient.Builder() .addInterceptor(loggingInterceptor)