summaryrefslogtreecommitdiff
path: root/src/http/http.go
diff options
context:
space:
mode:
authorBrian Picciano <mediocregopher@gmail.com>2024-05-26 22:06:44 +0200
committerBrian Picciano <mediocregopher@gmail.com>2024-05-26 22:06:44 +0200
commitfaa296075f5ea2d8e01004b46b036997f9529d99 (patch)
tree5d5e2cb693302dd7239aa02a183d2b0efff242c2 /src/http/http.go
parent006c0028106425abb3f718b2e86349dee5b7a2ea (diff)
Clean out Get/SetRequestLogger from apiutil
Diffstat (limited to 'src/http/http.go')
-rw-r--r--src/http/http.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/http/http.go b/src/http/http.go
index 4403a69..11b4976 100644
--- a/src/http/http.go
+++ b/src/http/http.go
@@ -209,8 +209,9 @@ func (a *api) blogHandler() http.Handler {
mux.Handle("/drafts/", http.StripPrefix("/drafts",
// everything to do with drafts is protected
- authMiddleware(a.auther)(
-
+ authMiddleware(
+ a.params.Logger.WithNamespace("drafts-auther"), a.auther,
+ )(
apiutil.MethodMux(map[string]http.Handler{
"EDIT": a.editPostHandler(true),
"MANAGE": a.manageDraftPostsHandler(),
@@ -228,13 +229,13 @@ func (a *api) blogHandler() http.Handler {
mux.Handle("/", a.renderIndexHandler())
readOnlyMiddlewares := []middleware{
- logReqMiddleware, // only log GETs on cache miss
+ logReqMiddleware(a.params.Logger), // only log GETs on cache miss
cacheMiddleware(a.params.Cache, a.params.PublicURL),
}
readWriteMiddlewares := []middleware{
- purgeCacheOnOKMiddleware(a.params.Cache),
- authMiddleware(a.auther),
+ purgeCacheOnOKMiddleware(a.params.Logger, a.params.Cache),
+ authMiddleware(a.params.Logger.WithNamespace("rw-auther"), a.auther),
}
h := apiutil.MethodMux(map[string]http.Handler{
@@ -270,7 +271,7 @@ func (a *api) handler() http.Handler {
noCacheMiddleware,
),
}),
- setLoggerMiddleware(a.params.Logger),
+ setLogCtxMiddleware(),
)
return h