CurlLoggingInterceptor now uses Timber to log

This commit is contained in:
Benoit Marty 2020-04-23 14:42:30 +02:00
parent 5f6969e2cc
commit b2aaf1cca1
3 changed files with 5 additions and 7 deletions

View File

@ -20,7 +20,6 @@ package im.vector.matrix.android.internal.network.interceptors
import im.vector.matrix.android.internal.di.MatrixScope
import okhttp3.Interceptor
import okhttp3.Response
import okhttp3.logging.HttpLoggingInterceptor
import okio.Buffer
import timber.log.Timber
import java.io.IOException
@ -37,7 +36,7 @@ import javax.inject.Inject
* non-production environment.
*/
@MatrixScope
internal class CurlLoggingInterceptor @Inject constructor(private val logger: HttpLoggingInterceptor.Logger)
internal class CurlLoggingInterceptor @Inject constructor()
: Interceptor {
/**
@ -97,8 +96,8 @@ internal class CurlLoggingInterceptor @Inject constructor(private val logger: Ht
// Add Json formatting
curlCmd += " | python -m json.tool"
logger.log("--- cURL (" + request.url + ")")
logger.log(curlCmd)
Timber.d("--- cURL (${request.url})")
Timber.d(curlCmd)
return chain.proceed(request)
}

View File

@ -57,7 +57,7 @@ internal object NetworkModule {
@Provides
@JvmStatic
fun providesCurlLoggingInterceptor(): CurlLoggingInterceptor {
return CurlLoggingInterceptor(HttpLoggingInterceptor.Logger.DEFAULT)
return CurlLoggingInterceptor()
}
@MatrixScope

View File

@ -20,7 +20,6 @@ package im.vector.matrix.android.internal.network.interceptors
import im.vector.matrix.android.internal.di.MatrixScope
import okhttp3.Interceptor
import okhttp3.Response
import okhttp3.logging.HttpLoggingInterceptor
import java.io.IOException
import javax.inject.Inject
@ -28,7 +27,7 @@ import javax.inject.Inject
* No op interceptor
*/
@MatrixScope
internal class CurlLoggingInterceptor @Inject constructor(private val logger: HttpLoggingInterceptor.Logger)
internal class CurlLoggingInterceptor @Inject constructor()
: Interceptor {
@Throws(IOException::class)