android - OkHttp - Enable logs -
I used retofit to paste HTTP requests and Jason, and I found it a great way to turn on debug logs. Logs are allowed to see body requests, url ... which is very useful. As the use of retofit ohity, I am wondering if there is a way of enabling logs for each request in the OHHTP. Interceptors feature is currently in review, but you can create your own version of okHttp with convenience by implementing code changes.
You can apply your kind of functionality
// Create an interceptor that captures requests and the information you want, log in requester = New request interceptor () {public request execution (request request) {Log.i ("request information", request.toString ()); Return request; // withdrawal request request}}; OKHTP Client Client = New OKHTP Client (); & Lt; RequestInterceptor & gt; RequestInterceptors = client.requestInterceptors (); RequestInterceptros.add (logRequests); The bridge is included in the request if you want to see more.
I have to give a warning before using it. Interceptor APIs may change because it is not merged yet. Do not use it with the production code, but it is unnecessary for personal testing.
Comments
Post a Comment