I have a Web API application which not only receives calls to its own endpoints but also makes calls to endpoints of another API. My goal is to log all the incoming & outgoing HTTP requests. It is quite obvious how to do it with an ActionFilter - Intercept all WebApi calls before the route matching occurs - but it would only work with incoming HTTP requests and that's not enough for me. I also need to intercept requests that my API makes to another API, like this one:
var response = await client.GetAsync("/api/my/endppoint/name");
I haven't found any examples despite googling a lot. What would be the best way?