elvishew/xLog

Please provide examples for API Requests and Responses

spragucm opened this issue · 1 comments

The only reason I found this library and tried to use it was in order to nicely display API Requests and Responses as shown on your main page.

Yet, there is no example showing how to do this :(

Can you please provide a quick example of how you achieved a nice log message for both situations?

Many thanks,
Chris

@spragucm You can take a look at HttpLoggingInterceptor of okhttp, customize a HttpLoggingInterceptor.Logger and use xLog to print the API response by calling

XLog.d(
    LogUtil.addBorder(
        new String[] {
            "<request type>",
            "<request url>",
            "<http status>",
            "<response body>"
        }))

Then you will see the similar result as the screenshot