gitee.com/h79/goutils@v1.22.10/common/logger/tag_test.go (about) 1 package logger 2 3 import "testing" 4 5 type Event struct { 6 Log string `log:"log"` 7 TimeStamp int64 `log:"TimeStamp,omitempty"` 8 } 9 type info struct { 10 Info string `log:"info"` //企业微信CorpID 11 Event *Event `log:"Event,omitempty"` 12 Id []string `log:"id,omitempty"` 13 Map map[string]string `log:"map,omitempty"` 14 In interface{} `log:"in,omitempty"` 15 } 16 17 func TestObjectTo(t *testing.T) { 18 e := &info{Info: "2333", Event: &Event{TimeStamp: 133}, Id: []string{"133", "1333"}, Map: map[string]string{"xxx": "yyy", "aa": "bbb"}, In: Event{}} 19 t.Logf("%s", ObjectTo(e)) 20 21 }