github.com/DapperCollectives/CAST/backend@v0.0.0-20230921221157-1350c8be7c96/main/middleware/logger.go (about) 1 package middleware 2 3 import ( 4 "flag" 5 "net/http" 6 7 "github.com/rs/zerolog/log" 8 ) 9 10 func Logger(next http.Handler) http.Handler { 11 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 12 if flag.Lookup("test.v") == nil { 13 log.Info().Msgf("%s %s", r.Method, r.RequestURI) 14 } 15 next.ServeHTTP(w, r) 16 }) 17 }