directory: add logging http client to help with debugging outbound http requests (#2385)

This commit is contained in:
Caleb Doxsey 2021-07-22 11:58:52 -06:00 committed by GitHub
parent aa0e6872de
commit ac8ae3ef5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 110 additions and 20 deletions

View file

@ -16,6 +16,7 @@ import (
"github.com/rs/zerolog"
"golang.org/x/oauth2"
"github.com/pomerium/pomerium/internal/httputil"
"github.com/pomerium/pomerium/internal/log"
"github.com/pomerium/pomerium/pkg/grpc/directory"
)
@ -43,7 +44,10 @@ func WithBatchSize(batchSize int) Option {
// WithHTTPClient sets the http client option.
func WithHTTPClient(httpClient *http.Client) Option {
return func(cfg *config) {
cfg.httpClient = httpClient
cfg.httpClient = httputil.NewLoggingClient(httpClient,
func(evt *zerolog.Event) *zerolog.Event {
return evt.Str("provider", "onelogin")
})
}
}