MCPcopy
hub / github.com/seaweedfs/seaweedfs / logMiddleware

Function logMiddleware

telemetry/server/main.go:101–111  ·  view source on GitHub ↗
(next http.HandlerFunc)

Source from the content-addressed store, hash-verified

99}
100
101func logMiddleware(next http.HandlerFunc) http.HandlerFunc {
102 return func(w http.ResponseWriter, r *http.Request) {
103 if *logRequests {
104 start := time.Now()
105 next(w, r)
106 log.Printf("%s %s %s %v", r.Method, r.URL.Path, r.RemoteAddr, time.Since(start))
107 } else {
108 next(w, r)
109 }
110 }
111}

Callers 1

mainFunction · 0.85

Calls 2

nextFunction · 0.85
NowMethod · 0.80

Tested by

no test coverage detected