CurlLoggingInterceptor now uses Timber to log
This commit is contained in:
parent
5f6969e2cc
commit
b2aaf1cca1
@ -20,7 +20,6 @@ package im.vector.matrix.android.internal.network.interceptors
|
|||||||
import im.vector.matrix.android.internal.di.MatrixScope
|
import im.vector.matrix.android.internal.di.MatrixScope
|
||||||
import okhttp3.Interceptor
|
import okhttp3.Interceptor
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import okhttp3.logging.HttpLoggingInterceptor
|
|
||||||
import okio.Buffer
|
import okio.Buffer
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
@ -37,7 +36,7 @@ import javax.inject.Inject
|
|||||||
* non-production environment.
|
* non-production environment.
|
||||||
*/
|
*/
|
||||||
@MatrixScope
|
@MatrixScope
|
||||||
internal class CurlLoggingInterceptor @Inject constructor(private val logger: HttpLoggingInterceptor.Logger)
|
internal class CurlLoggingInterceptor @Inject constructor()
|
||||||
: Interceptor {
|
: Interceptor {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -97,8 +96,8 @@ internal class CurlLoggingInterceptor @Inject constructor(private val logger: Ht
|
|||||||
// Add Json formatting
|
// Add Json formatting
|
||||||
curlCmd += " | python -m json.tool"
|
curlCmd += " | python -m json.tool"
|
||||||
|
|
||||||
logger.log("--- cURL (" + request.url + ")")
|
Timber.d("--- cURL (${request.url})")
|
||||||
logger.log(curlCmd)
|
Timber.d(curlCmd)
|
||||||
|
|
||||||
return chain.proceed(request)
|
return chain.proceed(request)
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ internal object NetworkModule {
|
|||||||
@Provides
|
@Provides
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun providesCurlLoggingInterceptor(): CurlLoggingInterceptor {
|
fun providesCurlLoggingInterceptor(): CurlLoggingInterceptor {
|
||||||
return CurlLoggingInterceptor(HttpLoggingInterceptor.Logger.DEFAULT)
|
return CurlLoggingInterceptor()
|
||||||
}
|
}
|
||||||
|
|
||||||
@MatrixScope
|
@MatrixScope
|
||||||
|
@ -20,7 +20,6 @@ package im.vector.matrix.android.internal.network.interceptors
|
|||||||
import im.vector.matrix.android.internal.di.MatrixScope
|
import im.vector.matrix.android.internal.di.MatrixScope
|
||||||
import okhttp3.Interceptor
|
import okhttp3.Interceptor
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import okhttp3.logging.HttpLoggingInterceptor
|
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@ -28,7 +27,7 @@ import javax.inject.Inject
|
|||||||
* No op interceptor
|
* No op interceptor
|
||||||
*/
|
*/
|
||||||
@MatrixScope
|
@MatrixScope
|
||||||
internal class CurlLoggingInterceptor @Inject constructor(private val logger: HttpLoggingInterceptor.Logger)
|
internal class CurlLoggingInterceptor @Inject constructor()
|
||||||
: Interceptor {
|
: Interceptor {
|
||||||
|
|
||||||
@Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user