Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit a564f18

Browse files
committed
Http logs enabled only in debug versions
1 parent 775fdb0 commit a564f18

File tree

1 file changed

+7
-1
lines changed
  • owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/http

1 file changed

+7
-1
lines changed

owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/http/HttpClient.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
import android.content.Context;
2828

29+
import com.owncloud.android.lib.BuildConfig;
2930
import com.owncloud.android.lib.common.network.AdvancedX509TrustManager;
3031
import com.owncloud.android.lib.common.network.NetworkUtils;
3132
import okhttp3.Cookie;
@@ -112,7 +113,6 @@ public List<Cookie> loadForRequest(HttpUrl url) {
112113

113114
OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder()
114115
.protocols(Arrays.asList(Protocol.HTTP_1_1))
115-
.addInterceptor(getLogInterceptor())
116116
.readTimeout(HttpConstants.DEFAULT_DATA_TIMEOUT, TimeUnit.MILLISECONDS)
117117
.writeTimeout(HttpConstants.DEFAULT_DATA_TIMEOUT, TimeUnit.MILLISECONDS)
118118
.connectTimeout(HttpConstants.DEFAULT_CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS)
@@ -122,6 +122,12 @@ public List<Cookie> loadForRequest(HttpUrl url) {
122122
.cookieJar(cookieJar);
123123
// TODO: Not verifying the hostname against certificate. ask owncloud security human if this is ok.
124124
//.hostnameVerifier(new BrowserCompatHostnameVerifier());
125+
126+
// Http logs enabled only in debug version. TODO: Add an option to enable and disable it.
127+
if (BuildConfig.DEBUG) {
128+
clientBuilder.addInterceptor(getLogInterceptor());
129+
}
130+
125131
sOkHttpClient = clientBuilder.build();
126132

127133
} catch (Exception e) {

0 commit comments

Comments
 (0)