nic-chen commented on a change in pull request #994:
URL: https://github.com/apache/apisix-dashboard/pull/994#discussion_r540164892
##########
File path: api/filter/logging.go
##########
@@ -16,4 +16,53 @@
*/
package filter
-//for logging access log, will refactor it in a new pr.
+import (
+ "bytes"
+ "time"
+
+ "github.com/gin-gonic/gin"
+ "go.uber.org/zap"
+)
+
+func RequestLogHandler(logger *zap.SugaredLogger) gin.HandlerFunc {
+ return func(c *gin.Context) {
+ start, host, remoteIP, path, method := time.Now(),
c.Request.Host, c.ClientIP(), c.Request.URL.Path, c.Request.Method
+ query := c.Request.URL.RawQuery
+ requestId := c.Writer.Header().Get("X-Request-Id")
+
+ blw := &bodyLogWriter{body: bytes.NewBufferString(""),
ResponseWriter: c.Writer}
Review comment:
fixed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]