Skip to content

Conversation

Jintin
Copy link

@Jintin Jintin commented Dec 8, 2020

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 Jintin changed the title POC of logging api result Add support of logging in object level Dec 11, 2020
@Jintin
Copy link
Author

Jintin commented Dec 11, 2020

btw I guess Android related build failed is normal?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant