您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213141516
  1. package middleware
  2. import (
  3. "net/http"
  4. "time"
  5. "github.com/Sirupsen/logrus"
  6. )
  7. func Logger(next http.Handler) http.Handler {
  8. return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
  9. start := time.Now()
  10. next.ServeHTTP(w, r)
  11. logrus.Debugf("%s - %s (%v)", r.Method, r.URL.Path, time.Since(start))
  12. })
  13. }