diff --git a/pkg/models/nats_system.go b/pkg/models/nats_system.go index c1c17b50..2bd12b09 100644 --- a/pkg/models/nats_system.go +++ b/pkg/models/nats_system.go @@ -22,7 +22,7 @@ func (m *NatsModel) RenewPNMToken(roomId, userId, token string) { err = m.natsService.BroadcastSystemEventToRoom(plugnmeet.NatsMsgServerToClientEvents_RESP_RENEW_PNM_TOKEN, roomId, token, &userId) if err != nil { - log.Errorln(err) + log.Errorln(fmt.Errorf("error renewing pnm token to %s; roomId: %s; msg: %s", userId, roomId, err.Error())) } } @@ -46,6 +46,6 @@ func (m *NatsModel) HandleClientPing(roomId, userId string) { err := m.natsService.UpdateUserKeyValue(roomId, userId, natsservice.UserLastPingAt, fmt.Sprintf("%d", time.Now().UnixMilli())) if err != nil { - log.Errorln(err) + log.Errorln(fmt.Sprintf("error updating user last ping to %s; roomId: %s; msg: %s", userId, roomId, err.Error())) } } diff --git a/pkg/models/nats_user.go b/pkg/models/nats_user.go index 9b4c19f4..d6543b7c 100644 --- a/pkg/models/nats_user.go +++ b/pkg/models/nats_user.go @@ -11,6 +11,7 @@ import ( func (m *NatsModel) OnAfterUserJoined(roomId, userId string) { status, err := m.natsService.GetRoomUserStatus(roomId, userId) if err != nil { + log.Errorln(fmt.Sprintf("error GetRoomUserStatus to %s; roomId: %s; msg: %s", roomId, userId, err)) return } if status == natsservice.UserStatusOnline { @@ -20,7 +21,7 @@ func (m *NatsModel) OnAfterUserJoined(roomId, userId string) { err = m.natsService.UpdateUserStatus(roomId, userId, natsservice.UserStatusOnline) if err != nil { - log.Warnln(err) + log.Warnln(fmt.Sprintf("Error updating user status to %s; roomId: %s; msg: %s", userId, roomId, err.Error())) } if userInfo, err := m.natsService.GetUserInfo(roomId, userId); err == nil && userInfo != nil { diff --git a/pkg/models/nats_user_event.go b/pkg/models/nats_user_event.go index a9b4a9f4..589d6166 100644 --- a/pkg/models/nats_user_event.go +++ b/pkg/models/nats_user_event.go @@ -1,6 +1,7 @@ package models import ( + "fmt" "github.com/mynaparrot/plugnmeet-protocol/plugnmeet" log "github.com/sirupsen/logrus" "strings" @@ -10,7 +11,7 @@ func (m *NatsModel) HandleInitialData(roomId, userId string) { // send room info rInfo, err := m.natsService.GetRoomInfo(roomId) if err != nil { - log.Errorln(err) + log.Errorln(fmt.Sprintf("error getting room info userId: %s, roomId: %s, msg: %s", userId, roomId, err.Error())) _ = m.natsService.NotifyErrorMsg(roomId, err.Error(), &userId) return } @@ -21,7 +22,7 @@ func (m *NatsModel) HandleInitialData(roomId, userId string) { // send this user's info userInfo, err := m.natsService.GetUserInfo(roomId, userId) if err != nil { - log.Errorln(err) + log.Errorln(fmt.Sprintf("error getting user info userId: %s, roomId: %s, msg: %s", userId, roomId, err.Error())) _ = m.natsService.NotifyErrorMsg(roomId, err.Error(), &userId) return } @@ -51,7 +52,7 @@ func (m *NatsModel) HandleInitialData(roomId, userId string) { // send important info first err = m.natsService.BroadcastSystemEventToRoom(plugnmeet.NatsMsgServerToClientEvents_RES_INITIAL_DATA, roomId, initial, &userId) if err != nil { - log.Warnln(err) + log.Warnln("error sending RES_INITIAL_DATA event userId: %s, roomId: %s, msg: %s", userId, roomId, err.Error()) } } @@ -59,7 +60,7 @@ func (m *NatsModel) HandleSendUsersList(roomId, userId string) { if users, err := m.natsService.GetOnlineUsersListAsJson(roomId); err == nil && users != nil { err := m.natsService.BroadcastSystemEventToRoom(plugnmeet.NatsMsgServerToClientEvents_RES_JOINED_USERS_LIST, roomId, users, &userId) if err != nil { - log.Warnln(err) + log.Warnln("error sending RES_JOINED_USERS_LIST event userId: %s, roomId: %s, msg: %s", userId, roomId, err.Error()) } } } diff --git a/pkg/models/user_modify.go b/pkg/models/user_modify.go index cafec900..4b4c6934 100644 --- a/pkg/models/user_modify.go +++ b/pkg/models/user_modify.go @@ -2,6 +2,7 @@ package models import ( "errors" + "fmt" "github.com/mynaparrot/plugnmeet-protocol/plugnmeet" "github.com/mynaparrot/plugnmeet-server/pkg/config" natsservice "github.com/mynaparrot/plugnmeet-server/pkg/services/nats" @@ -11,6 +12,7 @@ import ( func (m *UserModel) RemoveParticipant(r *plugnmeet.RemoveParticipantReq) error { status, err := m.natsService.GetRoomUserStatus(r.RoomId, r.UserId) if err != nil { + log.Errorln(fmt.Sprintf("error GetRoomUserStatus to %s; roomId: %s; msg: %s", r.GetRoomId(), r.GetUserId(), err)) return err } @@ -26,20 +28,20 @@ func (m *UserModel) RemoveParticipant(r *plugnmeet.RemoveParticipantReq) error { // send notification to be disconnected err = m.natsService.BroadcastSystemEventToRoom(plugnmeet.NatsMsgServerToClientEvents_SESSION_ENDED, r.GetRoomId(), "notifications.room-disconnected-participant-removed", &r.UserId) if err != nil { - log.Errorln(err) + log.Errorln(fmt.Sprintf("error broadcasting SESSION_ENDED event to %s; roomId: %s; msg: %s", r.GetRoomId(), r.GetUserId(), err)) } // now remove from lk _, err = m.lk.RemoveParticipant(r.RoomId, r.UserId) if err != nil { - log.Errorln(err) + log.Errorln(fmt.Sprintf("error removing user from lk to %s; roomId: %s; msg: %s", r.GetRoomId(), r.GetUserId(), err)) } // finally, check if requested to block as well as if r.BlockUser { _, err = m.natsService.AddUserToBlockList(r.RoomId, r.UserId) if err != nil { - log.Errorln(err) + log.Errorln(fmt.Sprintf("error AddUserToBlockList to %s; roomId: %s; msg: %s", r.GetRoomId(), r.GetUserId(), err)) } }