mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-14 05:12:26 +03:00
Use Unique from github.com/matrix-org/util (#28)
* Update github.com/matrix-org/util * Use Unique from github.com/matrix-org/util
This commit is contained in:
parent
8ba9d4af04
commit
84682b33c9
7 changed files with 185 additions and 69 deletions
|
@ -80,7 +80,7 @@ func Protect(handler http.HandlerFunc) http.HandlerFunc {
|
|||
return func(w http.ResponseWriter, req *http.Request) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
logger := req.Context().Value(ctxValueLogger).(*log.Entry)
|
||||
logger := GetLogger(req.Context())
|
||||
logger.WithFields(log.Fields{
|
||||
"panic": r,
|
||||
}).Errorf(
|
||||
|
@ -108,7 +108,7 @@ func MakeJSONAPI(handler JSONRequestHandler) http.HandlerFunc {
|
|||
ctx = context.WithValue(ctx, ctxValueRequestID, reqID)
|
||||
req = req.WithContext(ctx)
|
||||
|
||||
logger := req.Context().Value(ctxValueLogger).(*log.Entry)
|
||||
logger := GetLogger(req.Context())
|
||||
logger.Print("Incoming request")
|
||||
|
||||
res := handler.OnIncomingRequest(req)
|
||||
|
@ -122,7 +122,7 @@ func MakeJSONAPI(handler JSONRequestHandler) http.HandlerFunc {
|
|||
}
|
||||
|
||||
func respond(w http.ResponseWriter, req *http.Request, res JSONResponse) {
|
||||
logger := req.Context().Value(ctxValueLogger).(*log.Entry)
|
||||
logger := GetLogger(req.Context())
|
||||
|
||||
// Set custom headers
|
||||
if res.Headers != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue