1
0
mirror of https://github.com/rclone/rclone.git synced 2026-01-06 18:43:50 +00:00

Audit use of log.Print and change to Debug, Log, or ErrorLog as appropriate

This commit is contained in:
Nick Craig-Wood
2016-06-06 21:23:54 +01:00
parent 4882b8ba67
commit 67d0375b98
7 changed files with 32 additions and 34 deletions

View File

@@ -3,7 +3,6 @@
package fs
import (
"log"
"net/http"
"net/http/httputil"
)
@@ -35,7 +34,7 @@ func (t *LoggedTransport) CancelRequest(req *http.Request) {
if wrapped, ok := t.wrapped.(interface {
CancelRequest(*http.Request)
}); ok {
log.Printf("CANCEL REQUEST %v", req)
Debug(nil, "CANCEL REQUEST %v", req)
wrapped.CancelRequest(req)
}
}
@@ -43,19 +42,19 @@ func (t *LoggedTransport) CancelRequest(req *http.Request) {
// RoundTrip implements the RoundTripper interface.
func (t *LoggedTransport) RoundTrip(req *http.Request) (resp *http.Response, err error) {
buf, _ := httputil.DumpRequestOut(req, t.logBody)
log.Println(separatorReq)
log.Println("HTTP REQUEST")
log.Println(string(buf))
log.Println(separatorReq)
Debug(nil, "%s", separatorReq)
Debug(nil, "%s", "HTTP REQUEST")
Debug(nil, "%s", string(buf))
Debug(nil, "%s", separatorReq)
resp, err = t.wrapped.RoundTrip(req)
log.Println(separatorResp)
log.Println("HTTP RESPONSE")
Debug(nil, "%s", separatorResp)
Debug(nil, "%s", "HTTP RESPONSE")
if err != nil {
log.Printf("Error: %v\n", err)
Debug(nil, "Error: %v", err)
} else {
buf, _ = httputil.DumpResponse(resp, t.logBody)
log.Println(string(buf))
Debug(nil, "%s", string(buf))
}
log.Println(separatorResp)
Debug(nil, "%s", separatorResp)
return resp, err
}