use logging mddleware from common-lib
tronnet/workflows: Static Analysis -- Golang / static-go (push) Successful in 16s

This commit is contained in:
alu committed 2026-10-26 18:29:08 +00:00
1 parent 612fbddb33
commit 072691569e
2 files changed
+2 -10

No files matched your search

+1 -9
View File
@@ -170,16 +170,8 @@ func Run() {
} }
}) })
server := LoggingMiddleware(router) server := paas.LoggingMiddleware(router)
log.Printf("[INFO] starting API listening on 0.0.0.0:%d", config.ListenPort) log.Printf("[INFO] starting API listening on 0.0.0.0:%d", config.ListenPort)
log.Fatalf("[ERR ] starting gin router: %s", http.ListenAndServe("0.0.0.0:"+strconv.Itoa(config.ListenPort), server)) log.Fatalf("[ERR ] starting gin router: %s", http.ListenAndServe("0.0.0.0:"+strconv.Itoa(config.ListenPort), server))
} }
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))
})
}