Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
made request logger the last middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
sio4 committed Oct 1, 2022
1 parent 76f3353 commit 9885e24
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ func New(opts Options) *App {
a.Home.app = a // replace root.
a.Home.appSelf = a // temporary, reverse reference to the group app.

dem := a.defaultErrorMiddleware
a.Middleware = newMiddlewareStack(dem)

notFoundHandler := func(errorf string, code int) http.HandlerFunc {
return func(res http.ResponseWriter, req *http.Request) {
c := a.newContext(RouteInfo{}, res, req)
Expand All @@ -78,8 +75,10 @@ func New(opts Options) *App {
if a.MethodOverride == nil {
a.MethodOverride = MethodOverride
}

a.Middleware = newMiddlewareStack(RequestLogger)
a.Use(a.defaultErrorMiddleware)
a.Use(a.PanicHandler)
a.Use(RequestLogger)

return a
}

0 comments on commit 9885e24

Please sign in to comment.