...
Code Block | ||
---|---|---|
| ||
package main import ( "context" "github.com/gogf/gf/v2/frame/g" ) func main() { ctx := context.TODO() g.Log().Debug(ctx, g.Map{"uid": 100, "name": "john"}) type User struct { Uid int `json:"uid"` Name string `json:"name"` } g.Log().Debug(ctx, User{100, "john"}) } |
执行后,终端输出结果:
Code Block | ||
---|---|---|
| ||
2019-06-02 15:28:52.653 [DEBU] {"name":"john","uid":100}
2019-06-02 15:28:52.653 [DEBU] {"uid":100,"name":"john"} |
...