Skip to content

Commit

Permalink
fixes okhttp interceptor to log only in debug
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSheva-mason committed Jun 29, 2021
1 parent 9694c8f commit 23d556c
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.shevaalex.android.plugev.data.common.di

import com.shevaalex.android.plugev.BuildConfig
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
Expand All @@ -15,12 +16,13 @@ object DataModule {
@Singleton
@Provides
fun provideOkhttpClient(): OkHttpClient {
return OkHttpClient.Builder()
.addInterceptor(
HttpLoggingInterceptor()
.setLevel(HttpLoggingInterceptor.Level.BASIC)
val builder = OkHttpClient.Builder()
if (BuildConfig.DEBUG) {
builder.addInterceptor(
HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BASIC)
)
.build()
}
return builder.build()
}

}

0 comments on commit 23d556c

Please sign in to comment.