retrofit icon indicating copy to clipboard operation
retrofit copied to clipboard

Add support of logging in object level

Open Jintin opened this issue 5 years ago • 1 comments

Add support of object level logging in order to increase readability for case like binary response we can't log in OkHttp layer.

High level changes: Add one interface ObjectLogger with two implementation EmptyLogger and GsonLogger which print all attribute via gson. Add new function setObjectLogger in Retrofit.Builder in order to set ObjectLogger from outside. Add logging in SimpleService to test/verify easily.

Usage sample here:

Retrofit retrofit = new Retrofit.Builder()
    .baseUrl("https://api.example.com")
    .setObjectLogger(GsonLogger.create())
    .build();

Please let me know if there's any comment. Thanks.

Jintin avatar Dec 08 '20 16:12 Jintin

btw I guess Android related build failed is normal?

Jintin avatar Dec 11 '20 00:12 Jintin