mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Refactor Router Logger (#17308)
Make router logger more friendly, show the related function name/file/line. [BREAKING] This PR substantially changes the logging format of the router logger. If you use this logging for monitoring e.g. fail2ban you will need to update this to match the new format.
This commit is contained in:
@@ -21,6 +21,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/templates"
|
||||
"code.gitea.io/gitea/modules/validation"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/modules/web/routing"
|
||||
"code.gitea.io/gitea/routers/api/v1/misc"
|
||||
"code.gitea.io/gitea/routers/web/admin"
|
||||
"code.gitea.io/gitea/routers/web/auth"
|
||||
@@ -73,11 +74,11 @@ func CorsHandler() func(next http.Handler) http.Handler {
|
||||
func Routes(sessioner func(http.Handler) http.Handler) *web.Route {
|
||||
routes := web.NewRoute()
|
||||
|
||||
routes.Use(public.AssetsHandler(&public.Options{
|
||||
routes.Use(web.WrapWithPrefix(public.AssetsURLPathPrefix, public.AssetsHandlerFunc(&public.Options{
|
||||
Directory: path.Join(setting.StaticRootPath, "public"),
|
||||
Prefix: "/assets",
|
||||
Prefix: public.AssetsURLPathPrefix,
|
||||
CorsHandler: CorsHandler(),
|
||||
}))
|
||||
}), "AssetsHandler"))
|
||||
|
||||
routes.Use(sessioner)
|
||||
|
||||
@@ -293,7 +294,7 @@ func RegisterRoutes(m *web.Route) {
|
||||
})
|
||||
}, reqSignOut)
|
||||
|
||||
m.Any("/user/events", events.Events)
|
||||
m.Any("/user/events", routing.MarkLongPolling, events.Events)
|
||||
|
||||
m.Group("/login/oauth", func() {
|
||||
m.Get("/authorize", bindIgnErr(forms.AuthorizationForm{}), auth.AuthorizeOAuth)
|
||||
|
Reference in New Issue
Block a user