mirror of
https://github.com/elyby/chrly.git
synced 2024-12-23 21:50:03 +05:30
Enable requests logging for the worker.
Code is still duplicated. Will search for a solution later.
This commit is contained in:
parent
b0ba94751a
commit
c9f6079d90
@ -20,11 +20,18 @@ type UUIDsWorker struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ctx *UUIDsWorker) CreateHandler() *mux.Router {
|
func (ctx *UUIDsWorker) CreateHandler() *mux.Router {
|
||||||
|
requestEventsMiddleware := CreateRequestEventsMiddleware(ctx.Emitter, "skinsystem")
|
||||||
|
|
||||||
router := mux.NewRouter().StrictSlash(true)
|
router := mux.NewRouter().StrictSlash(true)
|
||||||
router.NotFoundHandler = http.HandlerFunc(NotFound)
|
router.Use(requestEventsMiddleware)
|
||||||
|
|
||||||
router.Handle("/api/worker/mojang-uuid/{username}", http.HandlerFunc(ctx.GetUUID)).Methods("GET")
|
router.Handle("/api/worker/mojang-uuid/{username}", http.HandlerFunc(ctx.GetUUID)).Methods("GET")
|
||||||
|
|
||||||
|
// 404
|
||||||
|
// NotFoundHandler doesn't call for registered middlewares, so we must wrap it manually.
|
||||||
|
// See https://github.com/gorilla/mux/issues/416#issuecomment-600079279
|
||||||
|
router.NotFoundHandler = requestEventsMiddleware(http.HandlerFunc(NotFound))
|
||||||
|
|
||||||
return router
|
return router
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user