More logging tweaks

This commit is contained in:
Neil Alexander 2022-01-31 16:01:54 +00:00
parent 07d0e72a8b
commit 893aa3b141
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
3 changed files with 21 additions and 13 deletions

View file

@ -51,13 +51,15 @@ func (r *Joiner) PerformJoin(
req *rsAPI.PerformJoinRequest,
res *rsAPI.PerformJoinResponse,
) {
logger := logrus.WithContext(ctx).WithFields(logrus.Fields{
"room_id": req.RoomIDOrAlias,
"user_id": req.UserID,
"servers": req.ServerNames,
})
logger.Info("User requested to room join")
roomID, joinedVia, err := r.performJoin(context.Background(), req)
if err != nil {
logrus.WithContext(ctx).WithFields(logrus.Fields{
"room_id": req.RoomIDOrAlias,
"user_id": req.UserID,
"servers": req.ServerNames,
}).WithError(err).Error("Failed to join room")
logger.WithError(err).Error("Failed to join room")
sentry.CaptureException(err)
perr, ok := err.(*rsAPI.PerformError)
if ok {
@ -67,7 +69,9 @@ func (r *Joiner) PerformJoin(
Msg: err.Error(),
}
}
return
}
logger.Info("User joined room successfully")
res.RoomID = roomID
res.JoinedVia = joinedVia
}