https://kotlinlang.org logo
#ktor
Title
# ktor
j

Jeff

07/13/2020, 1:54 PM
Hello, My client doesn't print logs when I make requests through my Android app. Any help would be appreciated. I only get to see:
Copy code
I/System.out: [OkHttp] sendRequest>>
The code is as follows:
Copy code
private val client by lazy {
        HttpClient {
            install(JsonFeature) {
                serializer = KotlinxSerializer(
                    Json(
                        JsonConfiguration(
                            isLenient = true,
                            ignoreUnknownKeys = true
                        )
                    )
                )
            }
            install(Logging) {
                logger = Logger.DEFAULT
                level = LogLevel.ALL
            }
        }
    }
z

zalewski.se

07/14/2020, 2:35 AM
Try with
Copy code
logger = Logger.SIMPLE
r

ritesh

07/14/2020, 7:23 AM
also you can also make you own logger,
Copy code
logger = MyLogger
...
object MyLogger: Logger {
    override fun log(message: String) {
        // log event like println or something else you want
    }
}
j

Jeff

07/14/2020, 7:42 AM
Thanks guys
2 Views