hashicorp / go-retryablehttp

Retryable HTTP client in Go
Mozilla Public License 2.0
1.99k stars 251 forks source link

feature(client.go): define error message #132

Open masahiro331 opened 3 years ago

masahiro331 commented 3 years ago

Hi maintainers.

Thank you for great library. I'd like to handling error log across versions.

e.g.

type logger struct{}

func (logger) Error(msg string, values ...interface{}) {
    // I don't want this implementation
    // if msg == "request failed" {
    // }

    // I want to implement this.
    if msg == RequestFailedMsg {
        // doSomething()
    }
    log.Logger.Errorw(msg, values)
}

func main() {
    retryClient := retryablehttp.NewClient()
    retryClient.Logger = logger{}
}

I like this library, Thank you.

hashicorp-cla commented 3 years ago

CLA assistant check
All committers have signed the CLA.