jsonrpc: client debug logging

This commit is contained in:
Łukasz Magiera 2019-07-09 15:16:15 +02:00
parent 093fabc1e7
commit 1bead4bb7e

View File

@ -40,7 +40,9 @@ func (e *ErrClient) Unwrap(err error) error {
type result reflect.Value
func (r *result) UnmarshalJSON(raw []byte) error {
return json.Unmarshal(raw, reflect.Value(*r).Interface())
err := json.Unmarshal(raw, reflect.Value(*r).Interface())
log.Debugw("rpc unmarshal response", "raw", string(raw), "err", err)
return err
}
type clientResponse struct {
@ -164,13 +166,14 @@ func NewClient(addr string, namespace string, handler interface{}) ClientCloser
return processError(err)
}
log.Warnw("rpc response", "body", string(rsp))
log.Debugw("rpc response", "body", string(rsp))
httpResp.Body = ioutil.NopCloser(bytes.NewReader(rsp))
}
var resp clientResponse
if valOut != -1 {
log.Debugw("rpc result", "type", ftyp.Out(valOut))
resp.Result = result(reflect.New(ftyp.Out(valOut)))
}