Converted logging middleware to use new logger

This commit is contained in:
2025-02-09 17:38:35 +11:00
parent b2ed646ffd
commit 49d9806bd6
4 changed files with 22 additions and 7 deletions

View File

@@ -5,10 +5,16 @@ import (
"net/http"
"projectreshoot/middleware"
"github.com/rs/zerolog"
)
// Returns a new http.Handler with all the routes and middleware added
func NewServer(config *Config, conn *sql.DB) http.Handler {
func NewServer(
config *Config,
logger *zerolog.Logger,
conn *sql.DB,
) http.Handler {
mux := http.NewServeMux()
addRoutes(
mux,
@@ -16,6 +22,6 @@ func NewServer(config *Config, conn *sql.DB) http.Handler {
conn,
)
var handler http.Handler = mux
handler = middleware.Logging(handler)
handler = middleware.Logging(logger, handler)
return handler
}