diff --git a/app/app.go b/app/app.go index 3edb87f..53ebdb3 100644 --- a/app/app.go +++ b/app/app.go @@ -5,12 +5,10 @@ import ( "fmt" "log" "net/http" + paas "proxmoxaas-common-lib" "proxmoxaas-dashboard/app/common" "proxmoxaas-dashboard/app/routes" "proxmoxaas-dashboard/app/web" - "time" - - //"web" // go will complain here until the first build "github.com/tdewolff/minify/v2" ) @@ -45,7 +43,7 @@ func Run() { router.HandleFunc("GET /login", routes.HandleGETLogin) router.HandleFunc("GET /settings", routes.HandleGETSettings) - server := LoggingMiddleware(router) + server := paas.LoggingMiddleware(router) log.Printf("[INFO] starting server listening on 0.0.0.0:%d", common.Global.Port) log.Fatalf("[ERR ] starting gin router: %s", http.ListenAndServe(fmt.Sprintf("0.0.0.0:%d", common.Global.Port), server)) @@ -62,11 +60,3 @@ func ServeStatic(router *http.ServeMux, m *minify.M) { w.Write([]byte(data.Data)) }) } - -func LoggingMiddleware(next http.Handler) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - start := time.Now() - next.ServeHTTP(w, r) - log.Printf("%s %s %s", r.Method, r.URL.Path, time.Since(start)) - }) -} diff --git a/proxmoxaas-common-lib b/proxmoxaas-common-lib index 35ecaf8..8b73652 160000 --- a/proxmoxaas-common-lib +++ b/proxmoxaas-common-lib @@ -1 +1 @@ -Subproject commit 35ecaf84e01d0ef6ffd5473cc8219897425b6a65 +Subproject commit 8b73652c9b1b5f9585a3539537991b702589249a