Просмотр исходного кода

Add more info in route logging
- Add remote address
- Add method
- Add protocol
- Add response size
- Use consistent unit for response time (us)

Piotr Popieluch 10 лет назад
Родитель
Сommit
579bc1c2c8
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      pkg/middleware/logger.go

+ 1 - 1
pkg/middleware/logger.go

@@ -32,7 +32,7 @@ func Logger() macaron.Handler {
 		rw := res.(macaron.ResponseWriter)
 		c.Next()
 
-		content := fmt.Sprintf("Completed %s %v %s in %v", req.URL.Path, rw.Status(), http.StatusText(rw.Status()), time.Since(start))
+		content := fmt.Sprintf("Completed %s \"%s %s %s\" %v %s %d bytes in %dus", c.RemoteAddr(), req.Method, req.URL.Path, req.Proto, rw.Status(), http.StatusText(rw.Status()), rw.Size(), time.Since(start)/time.Microsecond)
 
 		switch rw.Status() {
 		case 200, 304: