Files
.gitea
cli
cmd
pkg
app
autocomplete
client
compose
config
container
context
dns
formatter
git
integration
limit
lint
recipe
secret
server
service
ssh
upstream
web
client.go
web.go
scripts
tests
.drone.yml
.e2e.env.sample
.envrc.sample
.gitignore
.goreleaser.yml
AUTHORS.md
Makefile
README.md
go.mod
go.sum
renovate.json
abra/pkg/web/client.go

26 lines
636 B
Go

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
}