asynqmon/middlewares.go

17 lines
307 B
Go
Raw Normal View History

2020-12-07 23:14:30 +08:00
package main
import (
"fmt"
"net/http"
"os"
"time"
)
func loggingMiddleware(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(os.Stdout, "%v \"%s %s\"\n",
time.Now().Format(time.RFC3339), r.Method, r.URL)
h.ServeHTTP(w, r)
})
}