From 47a82c9bb4de407e8c14ed2e36784a52669af9d2 Mon Sep 17 00:00:00 2001 From: roc Date: Sun, 18 Sep 2022 22:17:36 +0800 Subject: [PATCH] optimize debug log level when cannot determine the unmarshal function --- middleware.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/middleware.go b/middleware.go index 3e0e1cd0..ac670fd4 100644 --- a/middleware.go +++ b/middleware.go @@ -231,7 +231,9 @@ func unmarshalBody(c *Client, r *Response, v interface{}) (err error) { } else if util.IsXMLType(ct) { return c.xmlUnmarshal(body, v) } else { - c.log.Debugf("cannot determine the unmarshal function with %q Content-Type, default to json", ct) + if c.DebugLog { + c.log.Debugf("cannot determine the unmarshal function with %q Content-Type, default to json", ct) + } return c.jsonUnmarshal(body, v) } return