I am using Retrofit with OkHttp. I like to add okhttp3.Interceptor to log the annotation path.
For example:
@GET("posts/{post_id}")
suspend fun getPost(@Path("post_id") postId: String): Response<Post>
Interceptor
class MyInterceptor : Interceptor {
@Throws(IOException::class)
override fun intercept(chain: Chain): Response {
// log the path here
}
}
I like to log posts/{post_id} each time getPost is called.
How can it be achieved?