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

Using custom logger type causes panic at runtime #243

Open
sochoaAtMulesoft opened this issue Oct 16, 2024 · 0 comments
Open

Using custom logger type causes panic at runtime #243

sochoaAtMulesoft opened this issue Oct 16, 2024 · 0 comments

Comments

@sochoaAtMulesoft
Copy link

sochoaAtMulesoft commented Oct 16, 2024

ref: main/client.go

Hey all. Can we Update the retryablehttp.Client.Logger field to be one of the following?

  1. A composite interface (ala go 1.18+ generics)?
type RetryableHttpLoggerConstraint interface {
    retryablehttp.Logger | retryablehttp.LeveledLogger
}
func SetLogger[T LoggerConstraint](client *retryablehttp.Client, logger T) {
    client.Logger = logger
}
  1. A single interface (retryablehttp.LeveledLogger or retryablehttp.Logger or something else)

Doing a type check and panic-ing at runtime is no bueno and is likely to cause incidents in production (like it did with us).

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

No branches or pull requests

1 participant