(pattern string, handler http.Handler)
| 79 | } |
| 80 | |
| 81 | func (opt *Plugin) logHandler(pattern string, handler http.Handler) http.Handler { |
| 82 | return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { |
| 83 | opt.Debug("visit", zap.String("path", r.URL.String()), zap.String("remote", r.RemoteAddr)) |
| 84 | name := strings.ToLower(opt.Name) |
| 85 | r.URL.Path = strings.TrimPrefix(r.URL.Path, "/"+name) |
| 86 | handler.ServeHTTP(rw, r) |
| 87 | }) |
| 88 | } |
| 89 | func (opt *Plugin) handle(pattern string, handler http.Handler) { |
| 90 | if opt == nil { |
| 91 | return |