Commit 16b232d2 authored by topjohnwu's avatar topjohnwu

Enable okhttp logging in debug only

parent 3f3b1f5b
...@@ -2,6 +2,7 @@ package com.topjohnwu.magisk.di ...@@ -2,6 +2,7 @@ package com.topjohnwu.magisk.di
import com.squareup.moshi.JsonAdapter import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.Moshi import com.squareup.moshi.Moshi
import com.topjohnwu.magisk.BuildConfig
import com.topjohnwu.magisk.Constants import com.topjohnwu.magisk.Constants
import com.topjohnwu.magisk.data.network.GithubRawApiServices import com.topjohnwu.magisk.data.network.GithubRawApiServices
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
...@@ -23,13 +24,16 @@ val networkingModule = module { ...@@ -23,13 +24,16 @@ val networkingModule = module {
} }
fun createOkHttpClient(): OkHttpClient { fun createOkHttpClient(): OkHttpClient {
val httpLoggingInterceptor = HttpLoggingInterceptor().apply { val builder = OkHttpClient.Builder()
level = HttpLoggingInterceptor.Level.BODY
if (BuildConfig.DEBUG) {
val httpLoggingInterceptor = HttpLoggingInterceptor().apply {
level = HttpLoggingInterceptor.Level.BODY
}
builder.addInterceptor(httpLoggingInterceptor)
} }
return OkHttpClient.Builder() return builder.build()
.addInterceptor(httpLoggingInterceptor)
.build()
} }
fun createConverterFactory(): Converter.Factory { fun createConverterFactory(): Converter.Factory {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment