From 4c2066d28f469bd22845aad275021b29504b5dd8 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sat, 31 Aug 2019 17:34:26 +0300 Subject: [PATCH] protonmail: log failed requests --- protonmail/protonmail.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/protonmail/protonmail.go b/protonmail/protonmail.go index 771e179..7db18a9 100644 --- a/protonmail/protonmail.go +++ b/protonmail/protonmail.go @@ -11,6 +11,8 @@ import ( "strconv" "golang.org/x/crypto/openpgp" + + "log" ) const Version = 3 @@ -75,6 +77,8 @@ func (c *Client) newRequest(method, path string, body io.Reader) (*http.Request, return nil, err } + //log.Printf(">> %v %v\n", method, path) + req.Header.Set("X-Pm-Appversion", c.AppVersion) req.Header.Set(headerAPIVersion, strconv.Itoa(Version)) c.setRequestAuthorization(req) @@ -155,6 +159,7 @@ func (c *Client) doJSON(req *http.Request, respData interface{}) error { if maybeError, ok := respData.(maybeError); ok { if err := maybeError.Err(); err != nil { + log.Printf("request failed: %v %v: %v", req.Method, req.URL.String(), err) return err } }