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(
}
req.SetBasicAuth(client.user, client.password)
req.Header.Set("Accept", "application/json")
client.log.Tracef("Request: %+v", req)
return req, nil
}
......@@ -379,10 +380,12 @@ func (client *DataplaneClient) StartTx(
if err != nil {
return
}
client.log.Tracef("StartTx response: %+v", resp)
body, err := getBody(resp)
if err != nil {
return
}
client.log.Tracef("StartTx response body: %s", string(body))
if resp.StatusCode == http.StatusCreated {
return getTx(body)
......@@ -414,10 +417,12 @@ func (client *DataplaneClient) FinishTx(
if err != nil {
return state, err
}
client.log.Tracef("FinishTx response: %+v", resp)
body, err := getBody(resp)
if err != nil {
return state, err
}
client.log.Tracef("FinishTx response body: %s", string(body))
switch resp.StatusCode {
case http.StatusOK, http.StatusAccepted:
......@@ -472,11 +477,13 @@ func (client *DataplaneClient) configTLS(
if err != nil {
return err
}
client.log.Tracef("configTLS response: %+v", resp)
body, err := getBody(resp)
if err != nil {
return err
}
client.log.Tracef("configTLS response body: %s", string(body))
switch resp.StatusCode {
case http.StatusAccepted:
......@@ -521,11 +528,13 @@ func (client *DataplaneClient) configDefaults(
if err != nil {
return err
}
client.log.Tracef("configDefaults response: %+v", resp)
body, err := getBody(resp)
if err != nil {
return err
}
client.log.Tracef("configDefaults response body: %s", string(body))
switch resp.StatusCode {
case http.StatusAccepted:
......@@ -652,10 +661,12 @@ func (client *DataplaneClient) Reloaded(id string) (bool, ReloadState, error) {
if err != nil {
return false, state, err
}
client.log.Tracef("Reloaded response: %+v", resp)
body, err := getBody(resp)
if err != nil {
return false, state, err
}
client.log.Tracef("Reloaded response body: %s", string(body))
switch resp.StatusCode {
case http.StatusOK:
......@@ -701,11 +712,12 @@ func (client *DataplaneClient) LoaderStatus() (
if err != nil {
return
}
client.log.Tracef("dataplane sites response: %+v", resp)
body, err := getBody(resp)
if err != nil {
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 != "" {
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