package web import ( "fmt" "github.com/hashicorp/go-retryablehttp" "github.com/sirupsen/logrus" ) // customLeveledLogger is custom logger with logrus baked in type customLeveledLogger struct { retryablehttp.Logger } // Printf wires up logrus into the custom retryablehttp logger func (l customLeveledLogger) Printf(msg string, args ...interface{}) { logrus.Debugf(fmt.Sprintf(msg, args...)) } // NewHTTPRetryClient instantiates a new http client with retries baked in func NewHTTPRetryClient() *retryablehttp.Client { retryClient := retryablehttp.NewClient() retryClient.Logger = customLeveledLogger{} return retryClient }