Commit cdb0f4f4 authored by Geoff Simmons's avatar Geoff Simmons

Verbose HTTP logging of the dataplane API at the trace level.

parent 0a993e8f
...@@ -320,6 +320,7 @@ func (client *DataplaneClient) getReq( ...@@ -320,6 +320,7 @@ func (client *DataplaneClient) getReq(
} }
req.SetBasicAuth(client.user, client.password) req.SetBasicAuth(client.user, client.password)
req.Header.Set("Accept", "application/json") req.Header.Set("Accept", "application/json")
client.log.Tracef("Request: %+v", req)
return req, nil return req, nil
} }
...@@ -379,10 +380,12 @@ func (client *DataplaneClient) StartTx( ...@@ -379,10 +380,12 @@ func (client *DataplaneClient) StartTx(
if err != nil { if err != nil {
return return
} }
client.log.Tracef("StartTx response: %+v", resp)
body, err := getBody(resp) body, err := getBody(resp)
if err != nil { if err != nil {
return return
} }
client.log.Tracef("StartTx response body: %s", string(body))
if resp.StatusCode == http.StatusCreated { if resp.StatusCode == http.StatusCreated {
return getTx(body) return getTx(body)
...@@ -414,10 +417,12 @@ func (client *DataplaneClient) FinishTx( ...@@ -414,10 +417,12 @@ func (client *DataplaneClient) FinishTx(
if err != nil { if err != nil {
return state, err return state, err
} }
client.log.Tracef("FinishTx response: %+v", resp)
body, err := getBody(resp) body, err := getBody(resp)
if err != nil { if err != nil {
return state, err return state, err
} }
client.log.Tracef("FinishTx response body: %s", string(body))
switch resp.StatusCode { switch resp.StatusCode {
case http.StatusOK, http.StatusAccepted: case http.StatusOK, http.StatusAccepted:
...@@ -472,11 +477,13 @@ func (client *DataplaneClient) configTLS( ...@@ -472,11 +477,13 @@ func (client *DataplaneClient) configTLS(
if err != nil { if err != nil {
return err return err
} }
client.log.Tracef("configTLS response: %+v", resp)
body, err := getBody(resp) body, err := getBody(resp)
if err != nil { if err != nil {
return err return err
} }
client.log.Tracef("configTLS response body: %s", string(body))
switch resp.StatusCode { switch resp.StatusCode {
case http.StatusAccepted: case http.StatusAccepted:
...@@ -521,11 +528,13 @@ func (client *DataplaneClient) configDefaults( ...@@ -521,11 +528,13 @@ func (client *DataplaneClient) configDefaults(
if err != nil { if err != nil {
return err return err
} }
client.log.Tracef("configDefaults response: %+v", resp)
body, err := getBody(resp) body, err := getBody(resp)
if err != nil { if err != nil {
return err return err
} }
client.log.Tracef("configDefaults response body: %s", string(body))
switch resp.StatusCode { switch resp.StatusCode {
case http.StatusAccepted: case http.StatusAccepted:
...@@ -652,10 +661,12 @@ func (client *DataplaneClient) Reloaded(id string) (bool, ReloadState, error) { ...@@ -652,10 +661,12 @@ func (client *DataplaneClient) Reloaded(id string) (bool, ReloadState, error) {
if err != nil { if err != nil {
return false, state, err return false, state, err
} }
client.log.Tracef("Reloaded response: %+v", resp)
body, err := getBody(resp) body, err := getBody(resp)
if err != nil { if err != nil {
return false, state, err return false, state, err
} }
client.log.Tracef("Reloaded response body: %s", string(body))
switch resp.StatusCode { switch resp.StatusCode {
case http.StatusOK: case http.StatusOK:
...@@ -701,11 +712,12 @@ func (client *DataplaneClient) LoaderStatus() ( ...@@ -701,11 +712,12 @@ func (client *DataplaneClient) LoaderStatus() (
if err != nil { if err != nil {
return return
} }
client.log.Tracef("dataplane sites response: %+v", resp)
body, err := getBody(resp) body, err := getBody(resp)
if err != nil { if err != nil {
return return
} }
client.log.Tracef("dataplane sites response body: %s", body) client.log.Tracef("dataplane sites response body: %s", string(body))
if verStr := resp.Header.Get(versionHdr); verStr != "" { if verStr := resp.Header.Get(versionHdr); verStr != "" {
client.log.Tracef("dataplane sites version: %s", verStr) client.log.Tracef("dataplane sites version: %s", verStr)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment