- Read handler for create activities (notes only so far) - Read handler for note objects - Structure laid out for other objects, activities and collections - DB structure for activities created - Update access logging TODO: Create collections type in DB to describe a collection group
This commit is contained in:
parent
cfa0566c6d
commit
12c9e17c4b
24 changed files with 1327 additions and 206 deletions
28
web/public/middleware/traceRequestInfo.go
Normal file
28
web/public/middleware/traceRequestInfo.go
Normal file
|
@ -0,0 +1,28 @@
|
|||
package webmiddleware
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
webutils "git.mstar.dev/mstar/goutils/http"
|
||||
"github.com/rs/zerolog/hlog"
|
||||
)
|
||||
|
||||
func TraceRequestInfoMiddleware(h http.Handler) http.Handler {
|
||||
return webutils.ChainMiddlewares(
|
||||
h,
|
||||
hlog.AccessHandler(func(r *http.Request, status, size int, duration time.Duration) {
|
||||
body, _ := io.ReadAll(r.Body)
|
||||
r.Body = io.NopCloser(bytes.NewReader(body))
|
||||
hlog.FromRequest(r).Trace().Any("headers", r.Header).
|
||||
Bytes("body", body).
|
||||
Str("method", r.Method).
|
||||
Stringer("url", r.URL).
|
||||
Int("status", status).
|
||||
Int("size", size).
|
||||
Dur("duration", duration)
|
||||
}),
|
||||
)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue