remove logger from retryable client, it is not respecting loglevels (#1020)

This commit is contained in:
Dustin Decker 2023-01-13 15:28:00 -08:00 committed by GitHub
parent 45b02f46d9
commit bc27fef7bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,7 +9,6 @@ import (
"time" "time"
"github.com/hashicorp/go-retryablehttp" "github.com/hashicorp/go-retryablehttp"
"github.com/sirupsen/logrus"
) )
var caCerts = []string{ var caCerts = []string{
@ -94,7 +93,7 @@ func NewCustomTransport(T http.RoundTripper) *CustomTransport {
func PinnedRetryableHttpClient() *http.Client { func PinnedRetryableHttpClient() *http.Client {
httpClient := retryablehttp.NewClient() httpClient := retryablehttp.NewClient()
httpClient.Logger = logrus.WithField("name", "PinnedRetryableHttpClient").WithField("level", logrus.DebugLevel) httpClient.Logger = nil
httpClient.HTTPClient.Transport = NewCustomTransport(&http.Transport{ httpClient.HTTPClient.Transport = NewCustomTransport(&http.Transport{
TLSClientConfig: &tls.Config{ TLSClientConfig: &tls.Config{
RootCAs: PinnedCertPool(), RootCAs: PinnedCertPool(),
@ -116,7 +115,7 @@ func PinnedRetryableHttpClient() *http.Client {
func RetryableHttpClient() *http.Client { func RetryableHttpClient() *http.Client {
httpClient := retryablehttp.NewClient() httpClient := retryablehttp.NewClient()
httpClient.RetryMax = 3 httpClient.RetryMax = 3
httpClient.Logger = logrus.WithField("name", "RetryableHttpClient").WithField("level", logrus.DebugLevel) httpClient.Logger = nil
httpClient.HTTPClient.Timeout = 3 * time.Second httpClient.HTTPClient.Timeout = 3 * time.Second
httpClient.HTTPClient.Transport = NewCustomTransport(nil) httpClient.HTTPClient.Transport = NewCustomTransport(nil)
return httpClient.StandardClient() return httpClient.StandardClient()
@ -125,7 +124,7 @@ func RetryableHttpClient() *http.Client {
func RetryableHttpClientTimeout(timeOutSeconds int64) *http.Client { func RetryableHttpClientTimeout(timeOutSeconds int64) *http.Client {
httpClient := retryablehttp.NewClient() httpClient := retryablehttp.NewClient()
httpClient.RetryMax = 3 httpClient.RetryMax = 3
httpClient.Logger = logrus.WithField("name", "RetryableHttpClientTimeout").WithField("level", logrus.DebugLevel) httpClient.Logger = nil
httpClient.HTTPClient.Timeout = time.Duration(timeOutSeconds) * time.Second httpClient.HTTPClient.Timeout = time.Duration(timeOutSeconds) * time.Second
httpClient.HTTPClient.Transport = NewCustomTransport(nil) httpClient.HTTPClient.Transport = NewCustomTransport(nil)
return httpClient.StandardClient() return httpClient.StandardClient()