2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-11 15:51:02 +00:00
restic/internal/debug/round_tripper_release.go
Michael Eischer 1ed775e3a8 debug: support roundtripper logging also for release builds
Different from debug builds do not use the eofDetectRoundTripper if
logging is disabled.
2022-08-05 23:49:39 +02:00

17 lines
453 B
Go

//go:build !debug
// +build !debug
package debug
import "net/http"
// RoundTripper returns a new http.RoundTripper which logs all requests (if
// debug is enabled). When debug is not enabled, upstream is returned.
func RoundTripper(upstream http.RoundTripper) http.RoundTripper {
if opts.isEnabled {
// only use loggingRoundTripper if the debug log is configured
return loggingRoundTripper{eofDetectRoundTripper{upstream}}
}
return upstream
}