mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-22 19:51:39 +00:00
Improve logging when sending events (#883)
We have some failing sytests on sqlite but it's very difficult to debug due to lack of useful logging. This adds a log line for when a new event is sent (incl. logging the event ID) as well as adding a user_id field for all contextual logs so we know who initiated certain actions.
This commit is contained in:
parent
c31cb02271
commit
cdc1157785
@ -77,6 +77,7 @@ func SendEvent(
|
|||||||
util.GetLogger(req.Context()).WithError(err).Error("producer.SendEvents failed")
|
util.GetLogger(req.Context()).WithError(err).Error("producer.SendEvents failed")
|
||||||
return jsonerror.InternalServerError()
|
return jsonerror.InternalServerError()
|
||||||
}
|
}
|
||||||
|
util.GetLogger(req.Context()).WithField("event_id", eventID).Info("Sent event")
|
||||||
|
|
||||||
res := util.JSONResponse{
|
res := util.JSONResponse{
|
||||||
Code: http.StatusOK,
|
Code: http.StatusOK,
|
||||||
|
@ -25,6 +25,10 @@ func MakeAuthAPI(
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return *err
|
return *err
|
||||||
}
|
}
|
||||||
|
// add the user ID to the logger
|
||||||
|
logger := util.GetLogger((req.Context()))
|
||||||
|
logger = logger.WithField("user_id", device.UserID)
|
||||||
|
req = req.WithContext(util.ContextWithLogger(req.Context(), logger))
|
||||||
|
|
||||||
return f(req, device)
|
return f(req, device)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user