func RequestLogger(f LogFormatter) func(next http.Handler) http.Handler {
	return func(next http.Handler) http.Handler {
		fn := func(w http.ResponseWriter, r *http.Request) {
			entry := f.NewLogEntry(r)
			ww := NewWrapResponseWriter(w, r.ProtoMajor)
			t1 := time.Now()
			defer func() {
				entry.Write(ww.Status(), ww.BytesWritten(), time.Since(t1))
			}()
			next.ServeHTTP(ww, WithLogEntry(r, entry))
		}
		return http.HandlerFunc(fn)
	}
}
RequestLogger returns a logger handler using a custom LogFormatter.
package middleware
import (
	"bytes"
	"context"
	"log"
	"net/http"
	"os"
	"time"
)
var (
	LogEntryCtxKey = &contextKey{"LogEntry"}
	DefaultLogger = RequestLogger(&DefaultLogFormatter{Logger: log.New(os.Stdout, "", log.LstdFlags), NoColor: false})
)
func Logger(next http.Handler) http.Handler {
	return DefaultLogger(next)
}