From b53ee938edd8bea728d04c297b7a4c15ab842de5 Mon Sep 17 00:00:00 2001 From: DmitryZagorulko Date: Mon, 17 Dec 2018 14:34:15 +0300 Subject: [PATCH] improve debug log --- v1/client_test.go | 5 ++++- v1/request.go | 4 +--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/v1/client_test.go b/v1/client_test.go index dde96df..adb7248 100644 --- a/v1/client_test.go +++ b/v1/client_test.go @@ -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) { diff --git a/v1/request.go b/v1/request.go index 5727d74..5c72f37 100644 --- a/v1/request.go +++ b/v1/request.go @@ -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)