mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Some changes to logging.
This commit is contained in:
parent
ae89cef011
commit
64ea893ea0
3 changed files with 5 additions and 21 deletions
|
@ -336,7 +336,7 @@ public class GameController implements GameCallback {
|
|||
joinType = "rejoined";
|
||||
}
|
||||
user.addGame(playerId, gameSession);
|
||||
logger.debug("Player " + player.getLogName()+ " " + playerId + " has " + joinType + " gameId: " + game.getId());
|
||||
logger.debug("Player " + player.getName()+ " " + playerId + " has " + joinType + " gameId: " + game.getId());
|
||||
ChatManager.getInstance().broadcast(chatId, "", game.getPlayer(playerId).getLogName() + " has " + joinType + " the game", MessageColor.ORANGE, true, MessageType.GAME);
|
||||
checkStart();
|
||||
}
|
||||
|
|
|
@ -42,9 +42,7 @@ import java.util.UUID;
|
|||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.util.ThreadLocalStringBuilder;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -53,13 +51,11 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializable {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(CardsImpl.class);
|
||||
private static final transient ThreadLocalStringBuilder threadLocalBuilder = new ThreadLocalStringBuilder(200);
|
||||
|
||||
private static Random rnd = new Random();
|
||||
private UUID ownerId;
|
||||
private Zone zone;
|
||||
private boolean errorLogged = false;
|
||||
|
||||
public CardsImpl() { }
|
||||
|
||||
|
@ -200,21 +196,9 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
|
|||
Set<Card> cards = new LinkedHashSet<>();
|
||||
for (UUID cardId: this) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null) {
|
||||
if (card != null) { // this can happen during the cancelation (player concedes) of a game
|
||||
cards.add(card);
|
||||
} else {
|
||||
if (!errorLogged) { // this runs in iteration, so the flag helps to stop to fill the log file
|
||||
// seems like this can happen during the cancelation of a game
|
||||
logger.error("Card not found cardId: " + cardId + " gameId: " + game.getId() );
|
||||
for (Player player :game.getPlayers().values()) {
|
||||
logger.error(player.getName() + " inGame=" + (player.isInGame() ? "true":"false"));
|
||||
}
|
||||
for (StackTraceElement stackTraceElement: Thread.currentThread().getStackTrace()) {
|
||||
logger.error(stackTraceElement.toString());
|
||||
}
|
||||
errorLogged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return cards;
|
||||
}
|
||||
|
|
|
@ -1925,14 +1925,14 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
|
||||
@Override
|
||||
public void lostForced(Game game) {
|
||||
logger.debug(this.getLogName() + " has lost gameId: " + game.getId());
|
||||
logger.debug(this.getName() + " has lost gameId: " + game.getId());
|
||||
//20100423 - 603.9
|
||||
if (!this.wins) {
|
||||
this.loses = true;
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LOST, null, null, playerId));
|
||||
game.informPlayers(this.getLogName() + " has lost the game.");
|
||||
} else {
|
||||
logger.debug(this.getLogName() + " has already won - stop lost");
|
||||
logger.debug(this.getName() + " has already won - stop lost");
|
||||
}
|
||||
// for draw - first all players that have lost have to be set to lost
|
||||
if (!hasLeft()) {
|
||||
|
|
Loading…
Reference in a new issue