httpclient: Create trace logging for outgoing HTTP requests

Sometimes HTTP requests are buried inside third-party libraries where we
can't otherwise access their request method/URL, so this ensures we'll
always have at least a record of the fact that a request happened, even if
there's no other logging for why it did.

We only include the method and URL here under the assumption that
secret keys and other particularly sensitive information will not appear
there, in line with usual best-practices.
pull/22248/head
Martin Atkins 7 years ago
parent e1590d0a70
commit 0f2c4b3b68

@ -36,5 +36,6 @@ func (rt *userAgentRoundTripper) RoundTrip(req *http.Request) (*http.Response, e
if _, ok := req.Header["User-Agent"]; !ok {
req.Header.Set("User-Agent", rt.userAgent)
}
log.Printf("[TRACE] HTTP client %s request to %s", req.Method, req.URL.String())
return rt.inner.RoundTrip(req)
}

Loading…
Cancel
Save