mirror of
https://github.com/octoleo/restic.git
synced 2024-12-22 19:08:55 +00:00
Only log HTTP requests when a debug log is configured
The logged HTTP requests are only visible when a debug log is configured.
This commit is contained in:
parent
9ad8250a78
commit
07f4e7d10b
@ -66,7 +66,12 @@ type loggingRoundTripper struct {
|
||||
// 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 {
|
||||
return loggingRoundTripper{eofDetectRoundTripper{upstream}}
|
||||
eofRoundTripper := eofDetectRoundTripper{upstream}
|
||||
if opts.isEnabled {
|
||||
// only use loggingRoundTripper if the debug log is configured
|
||||
return loggingRoundTripper{eofRoundTripper}
|
||||
}
|
||||
return eofRoundTripper
|
||||
}
|
||||
|
||||
func (tr loggingRoundTripper) RoundTrip(req *http.Request) (res *http.Response, err error) {
|
||||
|
Loading…
Reference in New Issue
Block a user