Feat(Logger): Support persistent logging

This commit is contained in:
2024-08-16 14:39:36 +08:00
parent 3a6fb2a6f0
commit 4ba02420ed
5 changed files with 96 additions and 4 deletions

View File

@@ -11,6 +11,7 @@ import okhttp3.logging.HttpLoggingInterceptor
import top.fatweb.oxygen.toolbox.BuildConfig
import top.fatweb.oxygen.toolbox.data.network.OxygenNetworkDataSource
import top.fatweb.oxygen.toolbox.network.retrofit.RetrofitOxygenNetwork
import top.fatweb.oxygen.toolbox.util.HttpLogger
import javax.inject.Singleton
@Module
@@ -27,11 +28,10 @@ internal object NetworkModule {
fun okHttpCallFactory(): Call.Factory =
OkHttpClient.Builder()
.addInterceptor(
HttpLoggingInterceptor()
HttpLoggingInterceptor(HttpLogger())
.apply {
if (BuildConfig.DEBUG) {
level = HttpLoggingInterceptor.Level.BODY
}
level =
if (BuildConfig.DEBUG) HttpLoggingInterceptor.Level.BODY else HttpLoggingInterceptor.Level.BASIC
}
)
.build()