mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
better logging
This commit is contained in:
parent
5807b3d6bc
commit
be9f3be709
@ -62,7 +62,7 @@ type UnexpectedStatusError struct {
|
||||
|
||||
// Error returns a textual description of 'u'.
|
||||
func (u *UnexpectedStatusError) Error() string {
|
||||
return fmt.Sprintf("request [%#v] failed (%d) %s: %s", u.Request, u.Response.StatusCode, u.Response.Status, u.Body)
|
||||
return fmt.Sprintf("request [%+v] failed (%d) %s: %s", u.Request, u.Response.StatusCode, u.Response.Status, u.Body)
|
||||
}
|
||||
|
||||
// RequestConstructionError is returned when there's an error assembling a request.
|
||||
@ -242,7 +242,7 @@ func (r *Request) Body(obj interface{}) *Request {
|
||||
}
|
||||
r.body = bytes.NewBuffer(data)
|
||||
default:
|
||||
r.err = fmt.Errorf("unknown type used for body: %#v", obj)
|
||||
r.err = fmt.Errorf("unknown type used for body: %+v", obj)
|
||||
}
|
||||
return r
|
||||
}
|
||||
@ -309,7 +309,7 @@ func (r *Request) Watch() (watch.Interface, error) {
|
||||
if resp.Body != nil {
|
||||
body, _ = ioutil.ReadAll(resp.Body)
|
||||
}
|
||||
return nil, fmt.Errorf("for request '%v', got status: %v\nbody: %v", req.URL, resp.StatusCode, string(body))
|
||||
return nil, fmt.Errorf("for request '%+v', got status: %v\nbody: %v", req.URL, resp.StatusCode, string(body))
|
||||
}
|
||||
return watch.NewStreamWatcher(watchjson.NewDecoder(resp.Body, r.codec)), nil
|
||||
}
|
||||
|
@ -168,8 +168,8 @@ func (rl *respLogger) Write(b []byte) (int, error) {
|
||||
func (rl *respLogger) Flush() {
|
||||
if flusher, ok := rl.w.(http.Flusher); ok {
|
||||
flusher.Flush()
|
||||
} else {
|
||||
glog.V(2).Infof("Unable to convert %v into http.Flusher", rl.w)
|
||||
} else if glog.V(2) {
|
||||
glog.InfoDepth(1, fmt.Sprintf("Unable to convert %+v into http.Flusher", rl.w))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user