Hello I am trying to change sugar logger to global longer I checked possible fields which I can use but I couldn't something solve my problem
for example in some situations I use
zap.L().Debug("recv_cmd",
zap.String("user", c.GetString("user")),
zap.String("path", c.Request.URL.Path),
)
This is what I use in most of the cases but I have one different case which like this
params := make([]interface{}, 0, 20)
params = append(params,
"status", c.Writer.Status(),
"method", c.Request.Method
"path", c.Request.URL.Path,
"ip", c.ClientIP(),
)
if len(body) > 0 {
params = append(params, "body", string(body))
}
so in this case, I don't have a body in every request, so params obj doesn't have the same struck for each request
what I want is (this is just a simple demonstration I know stringer won't work)
zap.L().Info("Info",
zap.Stringer("request", params...),
)