mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
Some changes to server logging messages.
This commit is contained in:
parent
3cf53810d9
commit
5f85d52837
3 changed files with 61 additions and 15 deletions
|
|
@ -159,7 +159,18 @@ public class Session {
|
|||
}
|
||||
|
||||
public void userLostConnection() {
|
||||
logger.info("session disconnected for user " + userId);
|
||||
User user = UserManager.getInstance().getUser(userId);
|
||||
if (logger.isInfoEnabled()) {
|
||||
StringBuilder sb = new StringBuilder("user ");
|
||||
if (user == null) {
|
||||
sb.append("[user not found]");
|
||||
} else {
|
||||
sb.append(user.getName());
|
||||
}
|
||||
sb.append(" lost connection - userId: ").append(userId);
|
||||
sb.append(" sessionId: ").append(sessionId);
|
||||
logger.info(sb);
|
||||
}
|
||||
UserManager.getInstance().disconnect(userId, User.DisconnectReason.LostConnection);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ public class UserManager {
|
|||
ChatManager.getInstance().removeUser(userId, reason);
|
||||
if (users.containsKey(userId)) {
|
||||
User user = users.get(userId);
|
||||
logger.info(new StringBuilder("User ").append(user.getName()).append(" has lost connection userId:").append(userId));
|
||||
logger.debug(new StringBuilder("User ").append(user.getName()).append(" has lost connection userId:").append(userId));
|
||||
users.get(userId).setSessionId("");
|
||||
ChatManager.getInstance().broadcast(userId, "has lost connection", MessageColor.BLACK);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue