Browse code

Better debug message for post form data

Print json format instead of default `%q`

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>

Zhang Wei authored on 2015/12/17 16:55:39
Showing 1 changed files
... ...
@@ -38,7 +38,12 @@ func debugRequestMiddleware(handler httputils.APIFunc) httputils.APIFunc {
38 38
 						if _, exists := postForm["password"]; exists {
39 39
 							postForm["password"] = "*****"
40 40
 						}
41
-						logrus.Debugf("form data: %q", postForm)
41
+						formStr, errMarshal := json.Marshal(postForm)
42
+						if errMarshal == nil {
43
+							logrus.Debugf("form data: %s", string(formStr))
44
+						} else {
45
+							logrus.Debugf("form data: %q", postForm)
46
+						}
42 47
 					}
43 48
 				}
44 49
 			}