hashicorp / go-retryablehttp

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

Creation of new logger for "defaultLogger" is counterintuitive. #134

Open medains opened 3 years ago

medains commented 3 years ago

This line sets up a new logger.

https://github.com/hashicorp/go-retryablehttp/blob/02c1586c8f14be23e7eeb522f1094afbabf45e93/client.go#L53

Using log.Default() would have the same base behaviour.

A user who changes the behaviour of the default logger will not affect the default logger in go-retryablehttp. An example of this is that the terraform http-backend logs http requests with this line: https://github.com/hashicorp/go-retryablehttp/blob/02c1586c8f14be23e7eeb522f1094afbabf45e93/client.go#L551 these log lines are unaffected by the terraform logging environment variables.

mitar commented 2 years ago

log.Default() returns a pointer to the default logger, not a new logger with defaults?