`CallLogging` produces simple and to-the-point log...
# ktor
z
CallLogging
produces simple and to-the-point log messages:
INFO - 200 OK: POST - /route/ in 2981ms
Is it possible to have something similar for a "regular" HttpClient, i.e. what Id use on Android, or anywhere outside of
embeddedServer
?
s
There is a
Logging
plugin for
HttpClient
but it seems that there is no implementation for
Timber
or
LogCat
z
This is actually what I'm using currently, but the logs are very verbose no matter which level I use.
s
It should also be relatively easy to implement your own logging through
HttpSend
interceptor. https://ktor.io/docs/http-send.html
Copy code
val client = HttpClient(Apache)
client.plugin(HttpSend).intercept { request ->
    val originalCall = execute(request)
    // do logging
    originalCall
}
z
Thanks, that works, but is this such an uncommon request? I feel like someone else surely must feel the same way and want for a simple way to log calls (minus verbosity) without having a standalone implementation? 😅
s
Yes, I agree. I think it's fair to expect a similar
CalLogging
plugin for client.
I think a ticket on YouTrack for this would be good
z
Ill create one later today, will share link here when I do!
🙌 1
Support CallLogging like logging for any HttpClient I guess now we can find out if the community actually wants something like this, I know I sure do! Thanks again for your help 🙏🏽