package middleware import ( "context" "net/http" "go.uber.org/zap" ) type Func func(h http.Handler) http.Handler func WrapHandler(handler http.HandlerFunc) Func { return func(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { handler(w, r) h.ServeHTTP(w, r) }) } } func reqLogOrDefault(ctx context.Context, log *zap.Logger) *zap.Logger { reqLog := GetReqLog(ctx) if reqLog != nil { return reqLog } return log }