18 lines
366 B
Go
18 lines
366 B
Go
package middlewares
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/uptrace/bunrouter"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
func AccessLog(next bunrouter.HandlerFunc) bunrouter.HandlerFunc {
|
|
return func(w http.ResponseWriter, req bunrouter.Request) error {
|
|
zap.L().Info("access",
|
|
zap.String("method", req.Method),
|
|
zap.String("route", req.Params().Route()))
|
|
return next(w, req)
|
|
}
|
|
}
|