mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
always use log4j
removed all references to mage.util.Logging, java.util.logging transient static doesn't mean anything, since static fields are never included in serialization
This commit is contained in:
parent
28a087812a
commit
bfb428b13a
45 changed files with 71 additions and 178 deletions
|
|
@ -29,7 +29,7 @@ public class AbilityPicker extends JXPanel implements MouseWheelListener {
|
|||
private static final int DIALOG_WIDTH = 440;
|
||||
private static final int DIALOG_HEIGHT = 260;
|
||||
|
||||
private transient static final Logger log = Logger.getLogger(AbilityPicker.class);
|
||||
private static final Logger log = Logger.getLogger(AbilityPicker.class);
|
||||
|
||||
private JList rows;
|
||||
private List<Object> choices;
|
||||
|
|
|
|||
|
|
@ -36,8 +36,6 @@ package mage.client.dialog;
|
|||
import java.awt.Point;
|
||||
import java.beans.PropertyVetoException;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.InternalFrameAdapter;
|
||||
|
|
@ -50,6 +48,7 @@ import mage.client.util.gui.GuiDisplayUtil;
|
|||
import mage.view.CardsView;
|
||||
import mage.view.ExileView;
|
||||
import mage.view.SimpleCardsView;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.mage.plugins.card.utils.impl.ImageManagerImpl;
|
||||
|
||||
/**
|
||||
|
|
@ -58,6 +57,8 @@ import org.mage.plugins.card.utils.impl.ImageManagerImpl;
|
|||
*/
|
||||
public class CardInfoWindowDialog extends MageDialog {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(CardInfoWindowDialog.class);
|
||||
|
||||
public static enum ShowType {
|
||||
|
||||
REVEAL, REVEAL_TOP_LIBRARY, LOOKED_AT, EXILE, GRAVEYARD, OTHER
|
||||
|
|
@ -123,7 +124,7 @@ public class CardInfoWindowDialog extends MageDialog {
|
|||
try {
|
||||
this.setIcon(false);
|
||||
} catch (PropertyVetoException ex) {
|
||||
Logger.getLogger(CardInfoWindowDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
logger.error(null, ex);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ import javax.swing.*;
|
|||
*/
|
||||
public class FeedbackDialog extends javax.swing.JDialog {
|
||||
|
||||
private static final transient Logger log = Logger.getLogger(PreferencesDialog.class);
|
||||
private static final Logger log = Logger.getLogger(PreferencesDialog.class);
|
||||
|
||||
private String[] feedbackTypes = {"", "Bug or \"something doesn't work\"",
|
||||
"Feature or \"I need that function\"",
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public class PreferencesDialog extends javax.swing.JDialog {
|
||||
|
||||
private static final transient Logger log = Logger.getLogger(PreferencesDialog.class);
|
||||
private static final Logger log = Logger.getLogger(PreferencesDialog.class);
|
||||
|
||||
public static final String KEY_HAND_USE_BIG_CARDS = "handUseBigCards";
|
||||
public static final String KEY_SHOW_TOOLTIPS_ANY_ZONE = "showTooltipsInAnyZone";
|
||||
|
|
|
|||
|
|
@ -53,8 +53,6 @@ import java.util.LinkedList;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JComponent;
|
||||
|
|
@ -82,6 +80,7 @@ import mage.view.DraftPickView;
|
|||
import mage.view.DraftView;
|
||||
import mage.view.SimpleCardView;
|
||||
import mage.view.SimpleCardsView;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -89,6 +88,8 @@ import mage.view.SimpleCardsView;
|
|||
*/
|
||||
public class DraftPanel extends javax.swing.JPanel {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(DraftPanel.class);
|
||||
|
||||
private UUID draftId;
|
||||
private Session session;
|
||||
private Timer countdown;
|
||||
|
|
@ -185,7 +186,7 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
try {
|
||||
Files.write(pathToDraftLog(), "".getBytes(), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(DraftPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
logger.error(null, ex);
|
||||
}
|
||||
} else {
|
||||
logFilename = null;
|
||||
|
|
@ -523,7 +524,7 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
try {
|
||||
Files.write(pathToDraftLog(), data.getBytes(), StandardOpenOption.APPEND);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(DraftPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
logger.error(null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@
|
|||
package mage.client.unusedFiles;
|
||||
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.unusedFiles.CombatGroup;
|
||||
import mage.view.CombatGroupView;
|
||||
|
||||
import javax.swing.*;
|
||||
|
|
@ -44,9 +43,8 @@ import java.awt.*;
|
|||
import java.beans.PropertyVetoException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import mage.client.dialog.MageDialog;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -54,6 +52,8 @@ import mage.client.dialog.MageDialog;
|
|||
*/
|
||||
public class CombatDialog extends MageDialog {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(CombatDialog.class);
|
||||
|
||||
private UUID gameId;
|
||||
private BigCard bigCard;
|
||||
private int lastX = 500;
|
||||
|
|
@ -100,7 +100,7 @@ public class CombatDialog extends MageDialog {
|
|||
try {
|
||||
this.setSelected(true);
|
||||
} catch (PropertyVetoException ex) {
|
||||
Logger.getLogger(CombatDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
logger.error(null, ex);
|
||||
}
|
||||
pack();
|
||||
this.revalidate();
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public class DeckUtil {
|
||||
|
||||
private static final transient Logger log = Logger.getLogger(DeckUtil.class);
|
||||
private static final Logger log = Logger.getLogger(DeckUtil.class);
|
||||
|
||||
private DeckUtil() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package mage.utils.properties;
|
||||
|
||||
import com.j256.ormlite.logger.Logger;
|
||||
import com.j256.ormlite.logger.LoggerFactory;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
|
@ -12,7 +11,7 @@ import java.util.Properties;
|
|||
*/
|
||||
public class PropertiesUtil {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(PropertiesUtil.class);
|
||||
private static final Logger logger = Logger.getLogger(PropertiesUtil.class);
|
||||
|
||||
private static final String LOG_JDBC_URL = "jdbc:h2:file:./db/mage.h2;AUTO_SERVER=TRUE";
|
||||
private static final String FEEDBACK_JDBC_URL = "jdbc:h2:file:./db/feedback.h2;AUTO_SERVER=TRUE";
|
||||
|
|
@ -25,7 +24,7 @@ public class PropertiesUtil {
|
|||
try {
|
||||
properties.load(in);
|
||||
} catch (IOException e) {
|
||||
logger.error(e, "Couldn't load properties");
|
||||
logger.error("Couldn't load properties", e);
|
||||
}
|
||||
} else {
|
||||
logger.warn("No xmage.properties were found on classpath");
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class GameView implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final transient Logger logger = Logger.getLogger(GameView.class);
|
||||
private static final Logger logger = Logger.getLogger(GameView.class);
|
||||
|
||||
private final int priorityTime;
|
||||
private final List<PlayerView> players = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ import mage.players.Player;
|
|||
import mage.target.Target;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.Targets;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -111,7 +112,7 @@ import mage.target.Targets;
|
|||
*/
|
||||
public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
|
||||
|
||||
private static final transient org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(ComputerPlayer6.class);
|
||||
private static final Logger logger = Logger.getLogger(ComputerPlayer6.class);
|
||||
private static final ExecutorService pool = Executors.newFixedThreadPool(1);
|
||||
protected int maxDepth;
|
||||
protected int maxNodes;
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public class ComputerPlayer7 extends ComputerPlayer6 {
|
||||
|
||||
private static final transient Logger logger = Logger.getLogger(ComputerPlayer7.class);
|
||||
private static final Logger logger = Logger.getLogger(ComputerPlayer7.class);
|
||||
|
||||
private boolean allowBadMoves;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,14 +28,13 @@
|
|||
|
||||
package mage.player.ai;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import mage.util.Logging;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -43,7 +42,7 @@ import mage.util.Logging;
|
|||
*/
|
||||
public class Config2 {
|
||||
|
||||
private static final Logger logger = Logging.getLogger(Config2.class.getName());
|
||||
private static final Logger logger = Logger.getLogger(Config2.class);
|
||||
|
||||
// public static final int maxDepth;
|
||||
public static final int maxNodes;
|
||||
|
|
@ -70,9 +69,9 @@ public class Config2 {
|
|||
// p.setProperty("maxThinkSeconds", "30");
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
logger.log(Level.SEVERE, null, ex);
|
||||
logger.error(null, ex);
|
||||
} catch (URISyntaxException ex) {
|
||||
Logger.getLogger(Config2.class.getName()).log(Level.SEVERE, null, ex);
|
||||
logger.error(null, ex);
|
||||
}
|
||||
// maxDepth = Integer.parseInt(p.getProperty("maxDepth"));
|
||||
maxNodes = Integer.parseInt(p.getProperty("maxNodes"));
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.player.ai.ma.ArtificialScoringSystem;
|
||||
import mage.players.Player;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -19,7 +20,7 @@ import mage.players.Player;
|
|||
*/
|
||||
public class GameStateEvaluator2 {
|
||||
|
||||
private static final transient org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(GameStateEvaluator2.class);
|
||||
private static final Logger logger = Logger.getLogger(GameStateEvaluator2.class);
|
||||
|
||||
public static final int WIN_GAME_SCORE = 100000000;
|
||||
public static final int LOSE_GAME_SCORE = -WIN_GAME_SCORE;
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public class SimulatedPlayer2 extends ComputerPlayer {
|
||||
|
||||
private static final transient Logger logger = Logger.getLogger(SimulatedPlayer2.class);
|
||||
private static final Logger logger = Logger.getLogger(SimulatedPlayer2.class);
|
||||
private final boolean isSimulatedPlayer;
|
||||
private transient ConcurrentLinkedQueue<Ability> allActions;
|
||||
private boolean forced;
|
||||
|
|
|
|||
|
|
@ -29,11 +29,9 @@
|
|||
package mage.player.ai;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import mage.abilities.Ability;
|
||||
import mage.game.Game;
|
||||
import mage.util.Logging;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -41,7 +39,7 @@ import mage.util.Logging;
|
|||
*/
|
||||
public class SimulationWorker2 implements Callable {
|
||||
|
||||
private static final Logger logger = Logging.getLogger(SimulationWorker2.class.getName());
|
||||
private static final Logger logger = Logger.getLogger(SimulationWorker2.class);
|
||||
|
||||
private Game game;
|
||||
private SimulatedAction2 previousActions;
|
||||
|
|
@ -60,7 +58,7 @@ public class SimulationWorker2 implements Callable {
|
|||
try {
|
||||
// player.simulateAction(game, previousActions, action);
|
||||
} catch (Exception ex) {
|
||||
logger.log(Level.SEVERE, null, ex);
|
||||
logger.error(null, ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import mage.game.turn.EndOfCombatStep;
|
|||
import mage.game.turn.FirstCombatDamageStep;
|
||||
import mage.game.turn.Step;
|
||||
import mage.players.Player;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
@ -24,7 +25,7 @@ public class CombatUtil {
|
|||
|
||||
private static final List<Permanent> emptyList = new ArrayList<Permanent>();
|
||||
|
||||
private static final transient org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(CombatUtil.class);
|
||||
private static final Logger log = Logger.getLogger(CombatUtil.class);
|
||||
|
||||
private CombatUtil() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public class ComputerPlayer extends PlayerImpl implements Player {
|
||||
|
||||
private transient final static Logger log = Logger.getLogger(ComputerPlayer.class);
|
||||
private static final Logger log = Logger.getLogger(ComputerPlayer.class);
|
||||
|
||||
protected int PASSIVITY_PENALTY = 5; // Penalty value for doing nothing if some actions are availble
|
||||
protected boolean ALLOW_INTERRUPT = true; // change this for test / debugging purposes to false to switch off interrupts while debugging
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class ComputerPlayerMCTS extends ComputerPlayer implements Player {
|
|||
|
||||
protected transient MCTSNode root;
|
||||
protected int maxThinkTime;
|
||||
private static final transient Logger logger = Logger.getLogger(ComputerPlayerMCTS.class);
|
||||
private static final Logger logger = Logger.getLogger(ComputerPlayerMCTS.class);
|
||||
private int poolSize;
|
||||
|
||||
public ComputerPlayerMCTS(String name, RangeOfInfluence range, int skill) {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class MCTSExecutor implements Callable<Boolean> {
|
|||
protected UUID playerId;
|
||||
protected int simCount;
|
||||
|
||||
private static final transient Logger logger = Logger.getLogger(ComputerPlayerMCTS.class);
|
||||
private static final Logger logger = Logger.getLogger(ComputerPlayerMCTS.class);
|
||||
|
||||
public MCTSExecutor(Game sim, UUID playerId, int thinkTime) {
|
||||
this.playerId = playerId;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public class MCTSNode {
|
|||
public static final boolean USE_ACTION_CACHE = false;
|
||||
private static final double selectionCoefficient = Math.sqrt(2.0);
|
||||
private static final double passRatioTolerance = 0.0;
|
||||
private static final transient Logger logger = Logger.getLogger(MCTSNode.class);
|
||||
private static final Logger logger = Logger.getLogger(MCTSNode.class);
|
||||
|
||||
private int visits = 0;
|
||||
private int wins = 0;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ import java.util.UUID;
|
|||
*/
|
||||
public class MCTSPlayer extends ComputerPlayer {
|
||||
|
||||
private static final transient Logger logger = Logger.getLogger(MCTSPlayer.class);
|
||||
private static final Logger logger = Logger.getLogger(MCTSPlayer.class);
|
||||
|
||||
protected PassAbility pass = new PassAbility();
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public class SimulatedPlayerMCTS extends MCTSPlayer {
|
|||
private boolean isSimulatedPlayer;
|
||||
private static Random rnd = new Random();
|
||||
private int actionCount = 0;
|
||||
private static final transient Logger logger = Logger.getLogger(SimulatedPlayerMCTS.class);
|
||||
private static final Logger logger = Logger.getLogger(SimulatedPlayerMCTS.class);
|
||||
|
||||
public SimulatedPlayerMCTS(UUID id, boolean isSimulatedPlayer) {
|
||||
super(id);
|
||||
|
|
|
|||
|
|
@ -60,8 +60,8 @@ import java.util.concurrent.*;
|
|||
*/
|
||||
public class ComputerPlayer2 extends ComputerPlayer implements Player {
|
||||
|
||||
private static final transient Logger logger = Logger.getLogger(ComputerPlayer2.class);
|
||||
private static final transient ExecutorService pool = Executors.newFixedThreadPool(1);
|
||||
private static final Logger logger = Logger.getLogger(ComputerPlayer2.class);
|
||||
private static final ExecutorService pool = Executors.newFixedThreadPool(1);
|
||||
|
||||
protected int maxDepth;
|
||||
protected int maxNodes;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ import java.util.UUID;
|
|||
*/
|
||||
public class ComputerPlayer3 extends ComputerPlayer2 implements Player {
|
||||
|
||||
private static final transient Logger logger = Logger.getLogger(ComputerPlayer3.class);
|
||||
private static final Logger logger = Logger.getLogger(ComputerPlayer3.class);
|
||||
|
||||
public ComputerPlayer3(String name, RangeOfInfluence range, int skill) {
|
||||
super(name, range, skill);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public class GameStateEvaluator {
|
||||
|
||||
private static final transient Logger logger = Logger.getLogger(GameStateEvaluator.class);
|
||||
private static final Logger logger = Logger.getLogger(GameStateEvaluator.class);
|
||||
|
||||
private static final int LIFE_FACTOR = Config.evaluatorLifeFactor;
|
||||
private static final int PERMANENT_FACTOR = Config.evaluatorPermanentFactor;
|
||||
|
|
|
|||
|
|
@ -28,10 +28,9 @@
|
|||
|
||||
package mage.player.ai;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import mage.util.Logging;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -39,7 +38,7 @@ import mage.util.Logging;
|
|||
*/
|
||||
public class SimulateBlockWorker implements Callable {
|
||||
|
||||
private static final Logger logger = Logging.getLogger(SimulationWorker.class.getName());
|
||||
private static final Logger logger = Logger.getLogger(SimulationWorker.class);
|
||||
|
||||
private SimulationNode node;
|
||||
private ComputerPlayer3 player;
|
||||
|
|
@ -54,7 +53,7 @@ public class SimulateBlockWorker implements Callable {
|
|||
try {
|
||||
// player.simulateBlock(node);
|
||||
} catch (Exception ex) {
|
||||
logger.log(Level.SEVERE, null, ex);
|
||||
logger.error(null, ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
|
|||
*/
|
||||
public class SimulatedPlayer extends ComputerPlayer {
|
||||
|
||||
private static final transient Logger logger = Logger.getLogger(SimulatedPlayer.class);
|
||||
private static final Logger logger = Logger.getLogger(SimulatedPlayer.class);
|
||||
private boolean isSimulatedPlayer;
|
||||
private transient ConcurrentLinkedQueue<Ability> allActions;
|
||||
private static PassAbility pass = new PassAbility();
|
||||
|
|
|
|||
|
|
@ -29,11 +29,9 @@
|
|||
package mage.player.ai;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import mage.abilities.Ability;
|
||||
import mage.game.Game;
|
||||
import mage.util.Logging;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -41,7 +39,7 @@ import mage.util.Logging;
|
|||
*/
|
||||
public class SimulationWorker implements Callable {
|
||||
|
||||
private static final Logger logger = Logging.getLogger(SimulationWorker.class.getName());
|
||||
private static final Logger logger = Logger.getLogger(SimulationWorker.class);
|
||||
|
||||
private Game game;
|
||||
private SimulatedAction previousActions;
|
||||
|
|
@ -60,7 +58,7 @@ public class SimulationWorker implements Callable {
|
|||
try {
|
||||
// player.simulateAction(game, previousActions, action);
|
||||
} catch (Exception ex) {
|
||||
logger.log(Level.SEVERE, null, ex);
|
||||
logger.error(null, ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ package mage.sets.journeyintonyx;
|
|||
import java.util.Deque;
|
||||
import java.util.LinkedList;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Logger;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import java.util.UUID;
|
|||
*/
|
||||
public class LoadCallbackClient implements CallbackClient {
|
||||
|
||||
private static final transient Logger log = Logger.getLogger(LoadCallbackClient.class);
|
||||
private static final Logger log = Logger.getLogger(LoadCallbackClient.class);
|
||||
|
||||
private Session session;
|
||||
private UUID gameId;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public class SimpleMageClient implements MageClient {
|
|||
private final UUID clientId;
|
||||
private static final MageVersion version = new MageVersion(MageVersion.MAGE_VERSION_MAJOR, MageVersion.MAGE_VERSION_MINOR, MageVersion.MAGE_VERSION_PATCH, MageVersion.MAGE_VERSION_MINOR_PATCH, MageVersion.MAGE_VERSION_INFO);
|
||||
|
||||
private static final transient Logger log = Logger.getLogger(SimpleMageClient.class);
|
||||
private static final Logger log = Logger.getLogger(SimpleMageClient.class);
|
||||
|
||||
private final CallbackClient callbackClient;
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public class MageObjectReference implements Comparable<MageObjectReference>, Serializable {
|
||||
|
||||
private static final transient Logger logger = Logger.getLogger(MageObjectReference.class);
|
||||
private static final Logger logger = Logger.getLogger(MageObjectReference.class);
|
||||
|
||||
private final UUID sourceId;
|
||||
private final int zoneChangeCounter;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import mage.util.ThreadLocalStringBuilder;
|
|||
|
||||
public class ObjectColor implements Serializable, Copyable<ObjectColor>, Comparable<ObjectColor> {
|
||||
|
||||
private static final transient ThreadLocalStringBuilder threadLocalBuilder = new ThreadLocalStringBuilder(10);
|
||||
private static final ThreadLocalStringBuilder threadLocalBuilder = new ThreadLocalStringBuilder(10);
|
||||
|
||||
public static final ObjectColor WHITE = new ObjectColor("W");
|
||||
public static final ObjectColor BLUE = new ObjectColor("U");
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ import mage.util.ThreadLocalStringBuilder;
|
|||
*/
|
||||
public class AbilitiesImpl<T extends Ability> extends ArrayList<T> implements Abilities<T> {
|
||||
|
||||
private static final transient ThreadLocalStringBuilder threadLocalBuilder = new ThreadLocalStringBuilder(200);
|
||||
private static final ThreadLocalStringBuilder threadLocalBuilder = new ThreadLocalStringBuilder(200);
|
||||
|
||||
public AbilitiesImpl() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,8 +84,8 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public abstract class AbilityImpl implements Ability {
|
||||
|
||||
private static final transient Logger logger = Logger.getLogger(AbilityImpl.class);
|
||||
private static final transient ThreadLocalStringBuilder threadLocalBuilder = new ThreadLocalStringBuilder(100);
|
||||
private static final Logger logger = Logger.getLogger(AbilityImpl.class);
|
||||
private static final ThreadLocalStringBuilder threadLocalBuilder = new ThreadLocalStringBuilder(100);
|
||||
private static final List<Watcher> emptyWatchers = new ArrayList<>();
|
||||
private static final List<Ability> emptyAbilities = new ArrayList<>();
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public class ContinuousEffects implements Serializable {
|
||||
|
||||
private static final transient Logger logger = Logger.getLogger(ContinuousEffects.class);
|
||||
private static final Logger logger = Logger.getLogger(ContinuousEffects.class);
|
||||
|
||||
private long order = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ public class ArtificialScoringSystem implements ScoringSystem {
|
|||
|
||||
public static ArtificialScoringSystem inst;
|
||||
|
||||
private static final transient Logger log = Logger.getLogger(ArtificialScoringSystem.class);
|
||||
private static final Logger log = Logger.getLogger(ArtificialScoringSystem.class);
|
||||
|
||||
static {
|
||||
inst = new ArtificialScoringSystem();
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ import mage.util.ThreadLocalStringBuilder;
|
|||
*/
|
||||
public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializable {
|
||||
|
||||
private static final transient ThreadLocalStringBuilder threadLocalBuilder = new ThreadLocalStringBuilder(200);
|
||||
private static final ThreadLocalStringBuilder threadLocalBuilder = new ThreadLocalStringBuilder(200);
|
||||
|
||||
private static Random rnd = new Random();
|
||||
private UUID ownerId;
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
|
||||
private static final int ROLLBACK_TURNS_MAX = 4;
|
||||
|
||||
private static final transient Logger logger = Logger.getLogger(GameImpl.class);
|
||||
private static final Logger logger = Logger.getLogger(GameImpl.class);
|
||||
|
||||
private static final FilterPermanent filterAura = new FilterPermanent();
|
||||
private static final FilterPermanent filterEquipment = new FilterPermanent();
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ import mage.watchers.Watchers;
|
|||
*/
|
||||
public class GameState implements Serializable, Copyable<GameState> {
|
||||
|
||||
private static final transient ThreadLocalStringBuilder threadLocalBuilder = new ThreadLocalStringBuilder(1024);
|
||||
private static final ThreadLocalStringBuilder threadLocalBuilder = new ThreadLocalStringBuilder(1024);
|
||||
|
||||
private final Players players;
|
||||
private final PlayerList playerList;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ import java.util.List;
|
|||
*/
|
||||
public class GameStates implements Serializable {
|
||||
|
||||
private static final transient Logger logger = Logger.getLogger(GameStates.class);
|
||||
private static final Logger logger = Logger.getLogger(GameStates.class);
|
||||
|
||||
// private final List<byte[]> states;
|
||||
private final List<GameState> states;
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ import mage.util.ThreadLocalStringBuilder;
|
|||
*/
|
||||
public abstract class PermanentImpl extends CardImpl implements Permanent {
|
||||
|
||||
private static final transient ThreadLocalStringBuilder threadLocalBuilder = new ThreadLocalStringBuilder(300);
|
||||
private static final ThreadLocalStringBuilder threadLocalBuilder = new ThreadLocalStringBuilder(300);
|
||||
|
||||
protected boolean tapped;
|
||||
protected boolean flipped;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ import mage.util.ThreadLocalStringBuilder;
|
|||
*/
|
||||
public class Turn implements Serializable {
|
||||
|
||||
private static final transient ThreadLocalStringBuilder threadLocalBuilder = new ThreadLocalStringBuilder(50);
|
||||
private static final ThreadLocalStringBuilder threadLocalBuilder = new ThreadLocalStringBuilder(50);
|
||||
|
||||
private Phase currentPhase;
|
||||
private UUID activePlayerId;
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ import org.apache.log4j.Logger;
|
|||
|
||||
public abstract class PlayerImpl implements Player, Serializable {
|
||||
|
||||
private static final transient Logger logger = Logger.getLogger(PlayerImpl.class);
|
||||
private static final Logger logger = Logger.getLogger(PlayerImpl.class);
|
||||
|
||||
private static Random rnd = new Random();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,104 +0,0 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.util;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.logging.ConsoleHandler;
|
||||
import java.util.logging.Formatter;
|
||||
import java.util.logging.Handler;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.LogRecord;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class Logging {
|
||||
|
||||
public static Logger getLogger(String name) {
|
||||
Logger logger = Logger.getLogger(name);
|
||||
ConsoleHandler handler = new ConsoleHandler();
|
||||
handler.setFormatter(new LogFormatter());
|
||||
logger.addHandler(handler);
|
||||
logger.setUseParentHandlers(false);
|
||||
return logger;
|
||||
}
|
||||
|
||||
public static Level getLevel(Logger logger) {
|
||||
Level level = logger.getLevel();
|
||||
while (level == null && logger.getParent() != null) {
|
||||
logger = logger.getParent();
|
||||
level = logger.getLevel();
|
||||
}
|
||||
return level;
|
||||
}
|
||||
}
|
||||
|
||||
class LogFormatter extends Formatter {
|
||||
|
||||
private static final DateFormat df = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss.SSS");
|
||||
|
||||
@Override
|
||||
public String format(LogRecord record) {
|
||||
StringBuilder builder = new StringBuilder(1000);
|
||||
builder.append(df.format(new Date(record.getMillis()))).append(" - ");
|
||||
builder.append("[").append(record.getSourceClassName()).append(".");
|
||||
builder.append(record.getSourceMethodName()).append("] - ");
|
||||
builder.append("[").append(record.getLevel()).append("] - ");
|
||||
builder.append(formatMessage(record));
|
||||
if (record.getThrown() != null) {
|
||||
try {
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(sw);
|
||||
record.getThrown().printStackTrace(pw);
|
||||
pw.close();
|
||||
builder.append(sw.toString());
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
builder.append("\n");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHead(Handler h) {
|
||||
return super.getHead(h);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTail(Handler h) {
|
||||
return super.getTail(h);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue