Skip to content

Commit

Permalink
Update 优化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
xinliangnote committed Sep 30, 2019
1 parent 4302709 commit 5ca6cf2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions app/route/middleware/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,18 @@ func SetUp() gin.HandlerFunc {
// 日志格式
accessLogMap := make(map[string]interface{})

accessLogMap["request_time"] = startTime
accessLogMap["request_method"] = c.Request.Method
accessLogMap["request_uri"] = c.Request.RequestURI
accessLogMap["request_proto"] = c.Request.Proto
accessLogMap["request_ua"] = c.Request.UserAgent()
accessLogMap["request_referer"] = c.Request.Referer()
accessLogMap["request_time"] = startTime
accessLogMap["request_method"] = c.Request.Method
accessLogMap["request_uri"] = c.Request.RequestURI
accessLogMap["request_proto"] = c.Request.Proto
accessLogMap["request_ua"] = c.Request.UserAgent()
accessLogMap["request_referer"] = c.Request.Referer()
accessLogMap["request_post_data"] = c.Request.PostForm.Encode()
accessLogMap["request_client_ip"] = c.ClientIP()

accessLogMap["response_time"] = endTime
accessLogMap["response_code"] = responseCode
accessLogMap["response_msg"] = responseMsg
accessLogMap["response_msg"] = responseMsg
accessLogMap["response_data"] = responseData

accessLogMap["cost_time"] = fmt.Sprintf("%vms", endTime-startTime)
Expand Down

0 comments on commit 5ca6cf2

Please sign in to comment.