Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow configuring go-retryablehttp.Logger #626

Merged
merged 1 commit into from
Aug 14, 2023

Conversation

andrewsomething
Copy link
Member

Historically, godo has not done any logging on its own. When using the new WithRetryAndBackoffs option, this is no longer the case. When used, each request is logged to stderr. This is surprising and not always desirable (e.g. for a cli tool like doctl).

This PR exposes the go-retryablehttp.Logger option in the RetryConfig. It defaults to nil to prevent logging as this matches the historical behavior. A logger can be configured as knowing when/if a request is being retried is useful.

@@ -307,6 +308,9 @@ func New(httpClient *http.Client, opts ...ClientOpt) (*Client, error) {
retryableClient.RetryWaitMax = time.Duration(*c.RetryConfig.RetryWaitMax * float64(time.Second))
}

// By default this is nil and does not log.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@danaelhe danaelhe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@andrewsomething andrewsomething merged commit f0c13f6 into main Aug 14, 2023
7 checks passed
@andrewsomething andrewsomething deleted the asb/retryable-logger branch August 14, 2023 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants