feat(shared): log api requests
This commit is contained in:
parent
57e10f697a
commit
fc9cdc04d0
1 changed files with 9 additions and 0 deletions
|
|
@ -1,8 +1,10 @@
|
|||
package moe.lava.banksia.client.di
|
||||
|
||||
import io.ktor.client.HttpClient
|
||||
import io.ktor.client.plugins.HttpSend
|
||||
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
|
||||
import io.ktor.client.plugins.defaultRequest
|
||||
import io.ktor.client.plugins.plugin
|
||||
import io.ktor.serialization.kotlinx.json.json
|
||||
import kotlinx.serialization.json.Json
|
||||
import moe.lava.banksia.Constants
|
||||
|
|
@ -14,6 +16,7 @@ import moe.lava.banksia.client.repository.RouteRepository
|
|||
import moe.lava.banksia.client.repository.StopRepository
|
||||
import moe.lava.banksia.data.ptv.PtvService
|
||||
import moe.lava.banksia.ui.screens.MapScreenViewModel
|
||||
import moe.lava.banksia.util.log
|
||||
import org.koin.core.module.dsl.singleOf
|
||||
import org.koin.core.module.dsl.viewModelOf
|
||||
import org.koin.dsl.module
|
||||
|
|
@ -31,6 +34,12 @@ val ClientModule = module {
|
|||
defaultRequest {
|
||||
url(Constants.serverUrl)
|
||||
}
|
||||
}.also { client ->
|
||||
client.plugin(HttpSend).intercept { req ->
|
||||
val fullPath = req.url.build().encodedPathAndQuery
|
||||
log("ktor.client", fullPath)
|
||||
execute(req)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue