add chi logger middleware to admin

This commit is contained in:
AJ ONeal 2020-07-22 08:01:59 +00:00
parent 6b7a642350
commit b5b6c1ea03
1 changed files with 5 additions and 0 deletions

View File

@ -19,6 +19,7 @@ import (
"git.rootprojects.org/root/telebit/table" "git.rootprojects.org/root/telebit/table"
"github.com/go-chi/chi" "github.com/go-chi/chi"
"github.com/go-chi/chi/middleware"
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
) )
@ -27,6 +28,10 @@ var httpsrv *http.Server
func InitAdmin(authURL string) { func InitAdmin(authURL string) {
r := chi.NewRouter() r := chi.NewRouter()
r.Use(middleware.Logger)
//r.Use(middleware.Timeout(120 * time.Second))
r.Use(middleware.Recoverer)
r.Use(func(next http.Handler) http.Handler { r.Use(func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
next.ServeHTTP(w, r) next.ServeHTTP(w, r)