1
0
mirror of synced 2024-11-21 20:46:05 +03:00

improve debug log

This commit is contained in:
DmitryZagorulko 2018-12-17 14:34:15 +03:00
parent 878ef2f01a
commit b53ee938ed
2 changed files with 5 additions and 4 deletions

View File

@ -16,7 +16,10 @@ var (
)
func client() *MgClient {
return New(mgURL, mgToken)
c := New(mgURL, mgToken)
c.Debug = true
return c
}
func TestMgClient_TransportChannels(t *testing.T) {

View File

@ -62,9 +62,7 @@ func makeRequest(reqType, url string, buf io.Reader, c *MgClient) ([]byte, int,
req.Header.Set("X-Transport-Token", c.Token)
if c.Debug {
b := new(bytes.Buffer)
b.ReadFrom(buf)
log.Printf("MG TRANSPORT API Request: %s %s %s %s", reqType, url, c.Token, b.String())
log.Printf("MG TRANSPORT API Request: %s %s %s %v", reqType, url, c.Token, buf)
}
resp, err := c.httpClient.Do(req)