Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Http logging for ApolloHttpNetworkTransport (Kotlin Runtime) #3107

Closed
sav007 opened this issue May 13, 2021 · 3 comments
Closed

Http logging for ApolloHttpNetworkTransport (Kotlin Runtime) #3107

sav007 opened this issue May 13, 2021 · 3 comments

Comments

@sav007
Copy link
Contributor

sav007 commented May 13, 2021

Is your feature request related to a problem? Please describe.
There is no easy way right now to setup ApolloHttpNetworkTransport with logging http network traffic. The only feasible way is to create a custom instance of ApolloHttpNetworkTransport for each platform with preconfigured logging in Call.Factory / DataTaskFactory.

Describe the solution you'd like
It would be nice if Apollo client would have centralized API to configure networking logging.

@martinbonnin
Copy link
Contributor

+1. This also came up on slack lately: https://kotlinlang.slack.com/archives/C01A6KM1SBZ/p1620675645115900

What about a "okhttp-like" interceptors API that would work with HTTP requests instead of GraphQL requests?

@sav007
Copy link
Contributor Author

sav007 commented May 18, 2021

What about a "okhttp-like" interceptors API that would work with HTTP requests instead of GraphQL requests?

Yes that will work, the only concern with that if this means we are trying to build KMP version of OkHttp or own version of Ktor :). I would suggest to start with logging, as adding okhttp like interceptors could be a big feature by itself.

@martinbonnin
Copy link
Contributor

martinbonnin commented Jul 15, 2021

3.0.0-alpha01 has a LoggingInterceptor:

    val client = ApolloClient(
        networkTransport = HttpNetworkTransport(
            serverUrl = mockServer.url(),
            interceptors = listOf(LoggingInterceptor())
        )
    )

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

No branches or pull requests

2 participants