I'm trying to log calls with response time. So far no solution..
install(CallLogging) {
level = Level.INFO
disableDefaultColors()
format { call ->
val status = call.response.status()
val httpMethod = call.request.httpMethod.value
val path = call.request.path()
// How to access duration
val duration = ???
"$status $httpMethod $path $duration"
}
}
I can probably ObserveResponse but, i will have seperate log entries for one call..
Any ideas?
I found solution. But it is cumbersome..
Hope that KTOR will make more elegant solution in future...
Original answer Sergey Mashkov