Add custom data to LoggingInterceptor

Hi all!
I am migrating some Rest api into GraphQL, everything is working great except the integration with the logging/reporting tool we have.

After each response, we log the request, the response (either the error or the data) and some additional info like the like the screen name or some reference id to name some examples.

I was following the docs, specifically this interceptor, which gives me access to almost all the things I need.

This is a reduced example of the problem I am trying to solve.
This is the gateway, who exposes a way to make the queries/mutations

class MyGateway {
    private let client: ApolloClient
    init() { ... }

    func emptyBasket(type: BasketType) {
        client.perform(mutation: EmptyBasketMutation(type: .init(type)))
    }
}

Then in some other view model or view controller, we call the emptyBasket method:

class MyViewModel {
    private func emptyBasket()  {
        let extraLogParameters = [
        "screen": "checkout",
        "referenceId": "12345"
        ] // This is the extra info I want to have in the logs
        myGateway.emptyBasket(type: .coolBasket)
    }
}

The question is, how can I pass or access extraLogParameters in the following interceptor?

class RequestLoggingInterceptor: ApolloInterceptor {

  func interceptAsync<Operation: GraphQLOperation>(
    chain: RequestChain,
    request: HTTPRequest<Operation>,
    response: HTTPResponse<Operation>?,
    completion: @escaping (Result<GraphQLResult<Operation.Data>, Error>) -> Void
  ) {
    Logger.log(.debug, "Outgoing request: \(request)")
    // How can I access `extraLogParameters` here??
    chain.proceedAsync(
      request: request,
      response: response,
      completion: completion
    )
  }
}

Hi @RRUIZ5-JB - I realize this is a very late reply to your question but there is PR #3198 that might be able to help you here. It’s not merged yet but should be soon.

This is awesome! Thanks for the heads up.