浏览代码

Captures the path before any middleware modifies it

Manu Mtz-Almeida 10 年之前
父节点
当前提交
67f8f6bb69
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      logger.go

+ 2 - 1
logger.go

@@ -46,6 +46,7 @@ func LoggerWithFile(out io.Writer) HandlerFunc {
 	return func(c *Context) {
 	return func(c *Context) {
 		// Start timer
 		// Start timer
 		start := time.Now()
 		start := time.Now()
+		path := c.Request.URL.Path
 
 
 		// Process request
 		// Process request
 		c.Next()
 		c.Next()
@@ -67,7 +68,7 @@ func LoggerWithFile(out io.Writer) HandlerFunc {
 			latency,
 			latency,
 			clientIP,
 			clientIP,
 			methodColor, reset, method,
 			methodColor, reset, method,
-			c.Request.URL.Path,
+			path,
 			comment,
 			comment,
 		)
 		)
 	}
 	}