Skip to content

Instantly share code, notes, and snippets.

@RoRoche
Last active November 19, 2019 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RoRoche/1a3ab48b7f3839a209f5e40318c9d096 to your computer and use it in GitHub Desktop.
Save RoRoche/1a3ab48b7f3839a209f5e40318c9d096 to your computer and use it in GitHub Desktop.
import android.util.Log
import okhttp3.Response
class LoggableRequest(
origin: RestRequest,
private val tag: String = origin.javaClass.simpleName
) : RestRequest.Wrap(origin) {
override fun response(): Response {
Log.d(tag, "response - started")
val response = super.response()
Log.d(tag, "response - done with $response")
return response
}
override fun cancel() {
Log.d(tag, "cancel - started")
super.cancel()
Log.d(tag, "cancel - done")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment