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

made request logger the last middleware #2334

Merged
merged 1 commit into from
Oct 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}