fix: refine logging
This commit was merged in pull request #293.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
"me-fit/log"
|
||||
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
@@ -40,7 +41,7 @@ func Log(next http.Handler) http.Handler {
|
||||
}
|
||||
next.ServeHTTP(wrapped, r)
|
||||
|
||||
slog.Info(r.RemoteAddr + " " + strconv.Itoa(wrapped.StatusCode) + " " + r.Method + " " + r.URL.Path + " " + time.Since(start).String())
|
||||
log.Info(r.RemoteAddr + " " + strconv.Itoa(wrapped.StatusCode) + " " + r.Method + " " + r.URL.Path + " " + time.Since(start).String())
|
||||
metrics.WithLabelValues(r.URL.Path, r.Method, http.StatusText(wrapped.StatusCode)).Inc()
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user