#2 Logging mit kotlin-logging implementiert
This commit is contained in:
1 parent
698490a6f8
commit
4d827948f8
16 files changed
+93
-52
No files matched your search
@@ -14,6 +14,7 @@ import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import io.github.oshai.kotlinlogging.KotlinLogging
|
||||
import io.ktor.client.*
|
||||
import io.ktor.client.request.*
|
||||
import io.ktor.client.statement.*
|
||||
@@ -27,6 +28,8 @@ import org.jetbrains.compose.resources.painterResource
|
||||
import org.koin.compose.koinInject
|
||||
import org.koin.core.annotation.Single
|
||||
|
||||
private val logger = KotlinLogging.logger {}
|
||||
|
||||
@Composable
|
||||
@Preview
|
||||
fun App() {
|
||||
@@ -52,7 +55,7 @@ fun App() {
|
||||
}
|
||||
Button(onClick = {
|
||||
CoroutineScope(Dispatchers.Default).launch {
|
||||
println("requesting '/test'")
|
||||
logger.debug { "requesting '/test'" }
|
||||
test.request("/test")
|
||||
}
|
||||
}) {
|
||||
@@ -77,10 +80,11 @@ class TestAuth(val httpClient: HttpClient) {
|
||||
|
||||
private val srv = "https://kas.keinekekse.net/"
|
||||
suspend fun request(url: String) {
|
||||
println("connecting")
|
||||
logger.debug { "connecting" }
|
||||
val response = httpClient.get(srv + url)
|
||||
println("call to $url")
|
||||
println(response.status)
|
||||
println(response.bodyAsText())
|
||||
val body = response.bodyAsText()
|
||||
logger.debug { "call to $url" }
|
||||
logger.debug { response.status }
|
||||
logger.debug { body }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user