Skip to content

Commit efe088f

Browse files
committed
log okhttp body if the whole build is in debug mode
1 parent 177a07d commit efe088f

File tree

1 file changed

+7
-3
lines changed
  • firebase-auth-rest/core/src/main/java/com/anotherdev/firebase/auth/rest/api

1 file changed

+7
-3
lines changed

firebase-auth-rest/core/src/main/java/com/anotherdev/firebase/auth/rest/api/RestAuthApi.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package com.anotherdev.firebase.auth.rest.api;
22

3+
import android.content.Context;
4+
import android.content.pm.ApplicationInfo;
5+
36
import com.anotherdev.firebase.auth.init.AppContext;
47
import com.anotherdev.firebase.auth.util.FarGson;
58

@@ -9,7 +12,6 @@
912
import retrofit2.Retrofit;
1013
import retrofit2.converter.gson.GsonConverterFactory;
1114

12-
import static com.anotherdev.firebase.auth.core.BuildConfig.DEBUG;
1315
import static okhttp3.logging.HttpLoggingInterceptor.Level.BASIC;
1416
import static okhttp3.logging.HttpLoggingInterceptor.Level.BODY;
1517

@@ -20,9 +22,11 @@ public final class RestAuthApi {
2022

2123

2224
private RestAuthApi() {
25+
Context context = AppContext.get();
26+
boolean isDebugBuild = (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
2327
OkHttpClient okHttpClient = new OkHttpClient.Builder()
24-
.addInterceptor(new HttpLoggingInterceptor().setLevel(DEBUG ? BODY : BASIC))
25-
.addInterceptor(new RestAuthInterceptor(AppContext.get()))
28+
.addInterceptor(new HttpLoggingInterceptor().setLevel(isDebugBuild ? BODY : BASIC))
29+
.addInterceptor(new RestAuthInterceptor(context))
2630
.build();
2731

2832
auth = buildApi(okHttpClient, IdentityToolkitApi.BASE_URL, IdentityToolkitApi.class);

0 commit comments

Comments
 (0)