github.com/keysonzzz/kmg@v0.0.0-20151121023212-05317bfd7d39/kmgNet/kmgHttp/log.go (about) 1 package kmgHttp 2 3 import ( 4 "net/http" 5 ) 6 7 type LogStruct struct { 8 Method string 9 Url string 10 RemoteAddr string 11 UA string `json:",omitempty"` 12 Refer string `json:",omitempty"` 13 Host string `json:",omitempty"` 14 } 15 16 func NewLogStruct(req *http.Request) *LogStruct { 17 return &LogStruct{ 18 Method: req.Method, 19 Url: req.URL.String(), 20 RemoteAddr: req.RemoteAddr, 21 UA: req.UserAgent(), 22 Refer: req.Referer(), 23 Host: req.Host, 24 } 25 }