mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-30 04:52:46 +00:00
More logging tweaks
This commit is contained in:
parent
07d0e72a8b
commit
893aa3b141
3 changed files with 21 additions and 13 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -51,13 +51,17 @@ func (r *Leaver) PerformLeave(
|
|||
if domain != r.Cfg.Matrix.ServerName {
|
||||
return nil, fmt.Errorf("user %q does not belong to this homeserver", req.UserID)
|
||||
}
|
||||
logger := logrus.WithContext(ctx).WithFields(logrus.Fields{
|
||||
"room_id": req.RoomID,
|
||||
"user_id": req.UserID,
|
||||
})
|
||||
logger.Info("User requested to leave join")
|
||||
if strings.HasPrefix(req.RoomID, "!") {
|
||||
output, err := r.performLeaveRoomByID(context.Background(), req, res)
|
||||
if err != nil {
|
||||
logrus.WithContext(ctx).WithFields(logrus.Fields{
|
||||
"room_id": req.RoomID,
|
||||
"user_id": req.UserID,
|
||||
}).WithError(err).Error("Failed to leave room")
|
||||
logger.WithError(err).Error("Failed to leave room")
|
||||
} else {
|
||||
logger.Info("User left room successfully")
|
||||
}
|
||||
return output, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue