From a133c7c69343bec8accaa5eea809c97c673320bd Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Tue, 27 May 2008 20:00:28 +0000 Subject: [PATCH] Switch to new logging API. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@608 c613c5cb-e716-0410-b11b-feb51c14d237 --- src/java/com/threerings/micasa/Log.java | 47 ++-------------- .../threerings/micasa/client/ChatPanel.java | 6 +- .../micasa/client/ClientController.java | 13 +++-- .../threerings/micasa/client/MiCasaApp.java | 12 ++-- .../micasa/client/MiCasaApplet.java | 5 +- .../micasa/lobby/LobbyController.java | 16 +++--- .../threerings/micasa/lobby/LobbyManager.java | 5 +- .../micasa/lobby/LobbyRegistry.java | 9 +-- .../micasa/lobby/LobbySelector.java | 9 +-- .../micasa/lobby/table/TableItem.java | 7 ++- .../micasa/lobby/table/TableListView.java | 20 +++---- .../micasa/server/MiCasaServer.java | 8 +-- .../micasa/simulator/client/SimulatorApp.java | 14 ++--- .../simulator/client/SimulatorController.java | 11 ++-- .../simulator/server/SimulatorManager.java | 11 ++-- .../simulator/server/SimulatorProvider.java | 4 +- src/java/com/threerings/parlor/Log.java | 30 +--------- src/java/com/threerings/parlor/card/Log.java | 32 ++--------- .../card/client/CardGameController.java | 5 +- .../parlor/card/client/CardPanel.java | 3 +- .../parlor/card/server/CardGameManager.java | 4 +- .../server/TrickCardGameManagerDelegate.java | 17 +++--- .../threerings/parlor/client/Invitation.java | 10 ++-- .../parlor/client/ParlorDirector.java | 10 ++-- .../parlor/client/TableDirector.java | 21 +++---- .../parlor/game/client/GameController.java | 11 ++-- .../parlor/game/server/GameManager.java | 4 +- .../parlor/server/ParlorManager.java | 21 ++++--- .../parlor/server/TableManager.java | 19 ++++--- .../turn/server/TurnGameManagerDelegate.java | 11 ++-- src/java/com/threerings/puzzle/Log.java | 32 ++--------- .../puzzle/client/PuzzleBoardView.java | 11 ++-- .../puzzle/client/PuzzleController.java | 28 +++++----- .../threerings/puzzle/client/PuzzlePanel.java | 5 +- .../puzzle/drop/client/DropBoardView.java | 22 ++++---- .../drop/client/DropControllerDelegate.java | 27 ++++----- .../puzzle/drop/client/DropSprite.java | 2 +- .../puzzle/drop/data/DropBoard.java | 14 ++--- .../drop/server/DropManagerDelegate.java | 5 +- .../puzzle/drop/util/PieceDropper.java | 5 +- .../puzzle/server/PuzzleManager.java | 19 ++++--- .../com/threerings/puzzle/util/PointSet.java | 4 +- src/java/com/threerings/stage/Log.java | 32 ++--------- .../stage/client/SceneColorizer.java | 5 +- .../stage/client/StageSceneController.java | 7 ++- .../stage/client/StageScenePanel.java | 5 +- .../com/threerings/stage/data/StageScene.java | 4 +- .../stage/server/StageSceneManager.java | 25 +++++---- .../threerings/stage/server/StageServer.java | 5 +- .../stage/tools/editor/EditorApp.java | 23 ++++---- .../stage/tools/editor/EditorFrame.java | 23 ++++---- .../stage/tools/editor/EditorModel.java | 4 +- .../stage/tools/editor/EditorScenePanel.java | 8 ++- .../tools/editor/EditorToolBarPanel.java | 6 +- .../threerings/stage/tools/editor/Log.java | 56 ------------------- .../stage/tools/editor/PreferencesDialog.java | 4 +- .../stage/tools/editor/TestTileLoader.java | 7 ++- .../stage/tools/editor/TileInfoPanel.java | 7 ++- .../stage/tools/editor/util/TileSetUtil.java | 1 - .../stage/tools/viewer/ViewerApp.java | 9 +-- .../stage/tools/viewer/ViewerFrame.java | 7 ++- .../stage/tools/viewer/ViewerScenePanel.java | 5 +- .../stage/util/PlacementConstraints.java | 9 ++- .../threerings/stage/util/StageSceneUtil.java | 13 +++-- src/java/com/threerings/stats/Log.java | 2 +- .../stats/server/persist/StatRepository.java | 8 +-- src/java/com/threerings/whirled/Log.java | 39 ++----------- .../whirled/client/SceneDirector.java | 44 +++++++-------- .../threerings/whirled/data/SceneImpl.java | 7 +-- .../threerings/whirled/data/SceneUpdate.java | 4 +- .../server/AbstractSceneMoveHandler.java | 8 +-- .../whirled/server/SceneManager.java | 5 +- .../whirled/server/SceneRegistry.java | 22 +++----- .../whirled/server/WhirledServer.java | 3 +- .../server/persist/DummySceneRepository.java | 5 +- src/java/com/threerings/whirled/spot/Log.java | 32 ++--------- .../spot/client/SpotSceneDirector.java | 31 +++++----- .../whirled/spot/data/SpotSceneImpl.java | 4 +- .../whirled/spot/server/SpotProvider.java | 17 +++--- .../whirled/spot/server/SpotSceneManager.java | 35 +++++++----- .../spot/tools/xml/SpotSceneWriter.java | 5 +- .../whirled/tools/xml/SceneWriter.java | 5 +- .../threerings/whirled/util/UpdateList.java | 5 +- src/java/com/threerings/whirled/zone/Log.java | 32 ++--------- .../whirled/zone/client/ZoneDirector.java | 16 +++--- .../whirled/zone/server/ZoneMoveHandler.java | 5 +- .../whirled/zone/server/ZoneProvider.java | 7 ++- .../whirled/zone/server/ZoneRegistry.java | 5 +- .../com/threerings/parlor/TestClient.java | 15 ++--- .../com/threerings/parlor/TestServer.java | 8 +-- .../whirled/DummyClientSceneRepository.java | 5 +- 91 files changed, 486 insertions(+), 722 deletions(-) delete mode 100644 src/java/com/threerings/stage/tools/editor/Log.java diff --git a/src/java/com/threerings/micasa/Log.java b/src/java/com/threerings/micasa/Log.java index 8e6a71f8..1079a854 100644 --- a/src/java/com/threerings/micasa/Log.java +++ b/src/java/com/threerings/micasa/Log.java @@ -21,52 +21,13 @@ package com.threerings.micasa; +import com.samskivert.util.Logger; + /** - * A placeholder class that contains a reference to the log object used by - * the MiCasa package. This is a useful pattern to use when using the - * samskivert logging facilities. One creates a top-level class like this - * one that instantiates a log object with an name that identifies log - * messages from that package and then provides static methods that - * generate log messages using that instance. Then, classes in that - * package need only import the log wrapper class and can easily use it to - * generate log messages. For example: - * - *
- * import com.threerings.micasa.Log;
- * // ...
- * Log.warning("All hell is breaking loose!");
- * // ...
- * 
- * - * @see com.samskivert.util.Log + * Contains a reference to the log object used by the MiCasa package. */ public class Log { /** The static log instance configured for use by this package. */ - public static com.samskivert.util.Log log = - new com.samskivert.util.Log("micasa"); - - /** Convenience function. */ - public static void debug (String message) - { - log.debug(message); - } - - /** Convenience function. */ - public static void info (String message) - { - log.info(message); - } - - /** Convenience function. */ - public static void warning (String message) - { - log.warning(message); - } - - /** Convenience function. */ - public static void logStackTrace (Throwable t) - { - log.logStackTrace(com.samskivert.util.Log.WARNING, t); - } + public static Logger log = Logger.getLogger("com.threerings.micasa"); } diff --git a/src/java/com/threerings/micasa/client/ChatPanel.java b/src/java/com/threerings/micasa/client/ChatPanel.java index 193edbe4..15603b85 100644 --- a/src/java/com/threerings/micasa/client/ChatPanel.java +++ b/src/java/com/threerings/micasa/client/ChatPanel.java @@ -64,7 +64,7 @@ import com.threerings.crowd.data.OccupantInfo; import com.threerings.crowd.data.PlaceObject; import com.threerings.crowd.util.CrowdContext; -import com.threerings.micasa.Log; +import static com.threerings.micasa.Log.log; public class ChatPanel extends JPanel implements ActionListener, ChatDisplay, OccupantObserver, PlaceView @@ -267,7 +267,7 @@ public class ChatPanel extends JPanel return true; } else { - Log.warning("Received unknown message type [message=" + + log.warning("Received unknown message type [message=" + message + "]."); return false; } @@ -287,7 +287,7 @@ public class ChatPanel extends JPanel try { doc.insertString(doc.getLength(), text, style); } catch (BadLocationException ble) { - Log.warning("Unable to insert text!? [error=" + ble + "]."); + log.warning("Unable to insert text!? [error=" + ble + "]."); } } diff --git a/src/java/com/threerings/micasa/client/ClientController.java b/src/java/com/threerings/micasa/client/ClientController.java index 44002901..f4ced19f 100644 --- a/src/java/com/threerings/micasa/client/ClientController.java +++ b/src/java/com/threerings/micasa/client/ClientController.java @@ -29,10 +29,11 @@ import com.threerings.presents.client.SessionObserver; import com.threerings.crowd.data.BodyObject; -import com.threerings.micasa.Log; import com.threerings.micasa.data.MiCasaBootstrapData; import com.threerings.micasa.util.MiCasaContext; +import static com.threerings.micasa.Log.log; + /** * Responsible for top-level control of the client user interface. */ @@ -68,7 +69,7 @@ public class ClientController extends Controller return true; } - Log.info("Unhandled action: " + action); + log.info("Unhandled action: " + action); return false; } @@ -81,7 +82,7 @@ public class ClientController extends Controller // documentation inherited public void clientDidLogon (Client client) { - Log.info("Client did logon [client=" + client + "]."); + log.info("Client did logon [client=" + client + "]."); // keep the body object around for stuff _body = (BodyObject)client.getClientObject(); @@ -94,14 +95,14 @@ public class ClientController extends Controller try { jumpOidStr = System.getProperty("jumpoid"); } catch (SecurityException se) { - Log.info("Not checking for jumpOid as we're in an applet."); + log.info("Not checking for jumpOid as we're in an applet."); } if (jumpOidStr != null) { try { moveOid = Integer.parseInt(jumpOidStr); } catch (NumberFormatException nfe) { - Log.warning("Invalid jump oid [oid=" + jumpOidStr + + log.warning("Invalid jump oid [oid=" + jumpOidStr + ", err=" + nfe + "]."); } @@ -131,7 +132,7 @@ public class ClientController extends Controller // documentation inherited public void clientDidLogoff (Client client) { - Log.info("Client did logoff [client=" + client + "]."); + log.info("Client did logoff [client=" + client + "]."); // reinstate the logon panel _frame.setPanel(_logonPanel); diff --git a/src/java/com/threerings/micasa/client/MiCasaApp.java b/src/java/com/threerings/micasa/client/MiCasaApp.java index d64461fb..d553d7ca 100644 --- a/src/java/com/threerings/micasa/client/MiCasaApp.java +++ b/src/java/com/threerings/micasa/client/MiCasaApp.java @@ -29,7 +29,7 @@ import com.threerings.util.Name; import com.threerings.presents.client.Client; import com.threerings.presents.net.UsernamePasswordCreds; -import com.threerings.micasa.Log; +import static com.threerings.micasa.Log.log; /** * The micasa app is the main point of entry for the MiCasa client @@ -58,9 +58,8 @@ public class MiCasaApp try { _client = (MiCasaClient)Class.forName(cclass).newInstance(); } catch (Exception e) { - Log.warning("Unable to instantiate client class " + - "[cclass=" + cclass + "]."); - Log.logStackTrace(e); + log.warning("Unable to instantiate client class " + + "[cclass=" + cclass + "].", e); } // initialize our client instance @@ -76,7 +75,7 @@ public class MiCasaApp Client client = _client.getContext().getClient(); - Log.info("Using [server=" + server + "."); + log.info("Using [server=" + server + "."); client.setServer(server, Client.DEFAULT_SERVER_PORTS); // configure the client with some credentials and logon @@ -102,8 +101,7 @@ public class MiCasaApp // initialize the app app.init(); } catch (IOException ioe) { - Log.warning("Error initializing application."); - Log.logStackTrace(ioe); + log.warning("Error initializing application.", ioe); } // and run it diff --git a/src/java/com/threerings/micasa/client/MiCasaApplet.java b/src/java/com/threerings/micasa/client/MiCasaApplet.java index eabfe489..d2b2ce8b 100644 --- a/src/java/com/threerings/micasa/client/MiCasaApplet.java +++ b/src/java/com/threerings/micasa/client/MiCasaApplet.java @@ -31,7 +31,7 @@ import com.threerings.presents.client.Client; import com.threerings.presents.client.ClientAdapter; import com.threerings.presents.net.UsernamePasswordCreds; -import com.threerings.micasa.Log; +import static com.threerings.micasa.Log.log; /** * The MiCasa applet is used to make MiCasa games available via the web @@ -74,8 +74,7 @@ public class MiCasaApplet extends Applet }); } catch (IOException ioe) { - Log.warning("Unable to create client."); - Log.logStackTrace(ioe); + log.warning("Unable to create client.", ioe); } } diff --git a/src/java/com/threerings/micasa/lobby/LobbyController.java b/src/java/com/threerings/micasa/lobby/LobbyController.java index 2c760681..0fa417d3 100644 --- a/src/java/com/threerings/micasa/lobby/LobbyController.java +++ b/src/java/com/threerings/micasa/lobby/LobbyController.java @@ -32,9 +32,10 @@ import com.threerings.crowd.util.CrowdContext; import com.threerings.parlor.client.*; import com.threerings.parlor.game.data.GameConfig; -import com.threerings.micasa.Log; import com.threerings.micasa.util.MiCasaContext; +import static com.threerings.micasa.Log.log; + public class LobbyController extends PlaceController implements InvitationHandler, InvitationResponseObserver { @@ -71,8 +72,7 @@ public class LobbyController extends PlaceController _ctx.getParlorDirector().invite( new Name(invitee), config, this); } catch (Exception e) { - Log.warning("Error instantiating game config."); - Log.logStackTrace(e); + log.warning("Error instantiating game config.", e); } } @@ -84,7 +84,7 @@ public class LobbyController extends PlaceController // documentation inherited from interface public void invitationReceived (Invitation invite) { - Log.info("Invitation received [invite=" + invite + "]."); + log.info("Invitation received [invite=" + invite + "]."); // accept the invitation. we're game... invite.accept(); @@ -93,26 +93,26 @@ public class LobbyController extends PlaceController // documentation inherited from interface public void invitationCancelled (Invitation invite) { - Log.info("Invitation cancelled " + invite + "."); + log.info("Invitation cancelled " + invite + "."); } // documentation inherited from interface public void invitationAccepted (Invitation invite) { - Log.info("Invitation accepted " + invite + "."); + log.info("Invitation accepted " + invite + "."); } // documentation inherited from interface public void invitationRefused (Invitation invite, String message) { - Log.info("Invitation refused [invite=" + invite + + log.info("Invitation refused [invite=" + invite + ", message=" + message + "]."); } // documentation inherited from interface public void invitationCountered (Invitation invite, GameConfig config) { - Log.info("Invitation countered [invite=" + invite + + log.info("Invitation countered [invite=" + invite + ", config=" + config + "]."); } diff --git a/src/java/com/threerings/micasa/lobby/LobbyManager.java b/src/java/com/threerings/micasa/lobby/LobbyManager.java index 7fc50e7e..9283b6ee 100644 --- a/src/java/com/threerings/micasa/lobby/LobbyManager.java +++ b/src/java/com/threerings/micasa/lobby/LobbyManager.java @@ -26,7 +26,8 @@ import com.samskivert.util.StringUtil; import com.threerings.crowd.data.PlaceObject; import com.threerings.crowd.server.PlaceManager; -import com.threerings.micasa.Log; + +import static com.threerings.micasa.Log.log; /** * Takes care of the server side of a particular lobby. @@ -48,7 +49,7 @@ public class LobbyManager extends PlaceManager // let the lobby registry know that we're up and running lobreg.lobbyReady(_plobj.getOid(), _gameIdent, _name); - Log.info("Lobby manager initialized [ident=" + _gameIdent + + log.info("Lobby manager initialized [ident=" + _gameIdent + ", name=" + _name + "]."); } diff --git a/src/java/com/threerings/micasa/lobby/LobbyRegistry.java b/src/java/com/threerings/micasa/lobby/LobbyRegistry.java index 2d991d03..67cb2779 100644 --- a/src/java/com/threerings/micasa/lobby/LobbyRegistry.java +++ b/src/java/com/threerings/micasa/lobby/LobbyRegistry.java @@ -31,12 +31,13 @@ import com.threerings.presents.server.InvocationManager; import com.threerings.crowd.data.BodyObject; -import com.threerings.micasa.Log; import com.threerings.micasa.lobby.LobbyService.CategoriesListener; import com.threerings.micasa.lobby.LobbyService.LobbiesListener; import com.threerings.micasa.server.MiCasaConfig; import com.threerings.micasa.server.MiCasaServer; +import static com.threerings.micasa.Log.log; + /** * The lobby registry is the primary class that coordinates the lobby services on the client. It * sets up the necessary invocation services and keeps track of the lobbies in operation on the @@ -101,7 +102,7 @@ public class LobbyRegistry String[] lmgrs = null; lmgrs = MiCasaConfig.config.getValue(LOBIDS_KEY, lmgrs); if (lmgrs == null || lmgrs.length == 0) { - Log.warning("No lobbies specified in config file (via '" + + log.warning("No lobbies specified in config file (via '" + LOBIDS_KEY + "' parameter)."); } else { @@ -145,7 +146,7 @@ public class LobbyRegistry lobmgr.init(this, props); } catch (Exception e) { - Log.warning("Unable to create lobby manager [lobbyId=" + lobbyId + + log.warning("Unable to create lobby manager [lobbyId=" + lobbyId + ", error=" + e + "]."); } } @@ -239,7 +240,7 @@ public class LobbyRegistry _lobbies.put(category, catlist); } catlist.add(record); - Log.info("Registered lobby [cat=" + category + ", record=" + record + "]."); + log.info("Registered lobby [cat=" + category + ", record=" + record + "]."); } /** A table containing references to all of our lobby records (in the form of category diff --git a/src/java/com/threerings/micasa/lobby/LobbySelector.java b/src/java/com/threerings/micasa/lobby/LobbySelector.java index c8f954cd..dfd640ba 100644 --- a/src/java/com/threerings/micasa/lobby/LobbySelector.java +++ b/src/java/com/threerings/micasa/lobby/LobbySelector.java @@ -31,9 +31,10 @@ import javax.swing.*; import com.threerings.crowd.data.PlaceObject; -import com.threerings.micasa.Log; import com.threerings.micasa.util.MiCasaContext; +import static com.threerings.micasa.Log.log; + /** * The lobby selector displays a drop-down box listing the categories of * lobbies available on this server and when a category is selected, it @@ -141,7 +142,7 @@ public class LobbySelector extends JPanel // documentation inherited from interface public void requestFailed (String reason) { - Log.info("Request failed [reason=" + reason + "]."); + log.info("Request failed [reason=" + reason + "]."); // clear out our pending category indicator in case this was a // failed getLobbies() request @@ -166,7 +167,7 @@ public class LobbySelector extends JPanel _lservice.getLobbies(_ctx.getClient(), category, this); } else { - Log.info("Ignoring category select request because " + + log.info("Ignoring category select request because " + "one is outstanding [pcat=" + _pendingCategory + ", newcat=" + category + "]."); } @@ -184,7 +185,7 @@ public class LobbySelector extends JPanel // otherwise request that we go there _ctx.getLocationDirector().moveTo(lobby.placeOid); - Log.info("Entering lobby " + lobby + "."); + log.info("Entering lobby " + lobby + "."); } diff --git a/src/java/com/threerings/micasa/lobby/table/TableItem.java b/src/java/com/threerings/micasa/lobby/table/TableItem.java index b47580b0..4ffad666 100644 --- a/src/java/com/threerings/micasa/lobby/table/TableItem.java +++ b/src/java/com/threerings/micasa/lobby/table/TableItem.java @@ -42,9 +42,10 @@ import com.threerings.parlor.client.TableDirector; import com.threerings.parlor.client.SeatednessObserver; import com.threerings.parlor.data.Table; -import com.threerings.micasa.Log; import com.threerings.micasa.util.MiCasaContext; +import static com.threerings.micasa.Log.log; + /** * A table item displays the user interface for a single table (whether it * be in-play or still being matchmade). @@ -195,7 +196,7 @@ public class TableItem // sanity check if (position == -1) { - Log.warning("Unable to figure out what position a " + + log.warning("Unable to figure out what position a " + "click came from [event=" + event + "]."); } else { // otherwise, request to join the table at this position @@ -211,7 +212,7 @@ public class TableItem _ctx.getLocationDirector().moveTo(table.gameOid); } else { - Log.warning("Received unknown action [event=" + event + "]."); + log.warning("Received unknown action [event=" + event + "]."); } } diff --git a/src/java/com/threerings/micasa/lobby/table/TableListView.java b/src/java/com/threerings/micasa/lobby/table/TableListView.java index f8557e50..063fd17e 100644 --- a/src/java/com/threerings/micasa/lobby/table/TableListView.java +++ b/src/java/com/threerings/micasa/lobby/table/TableListView.java @@ -36,7 +36,6 @@ import com.samskivert.swing.HGroupLayout; import com.samskivert.swing.VGroupLayout; import com.samskivert.swing.util.SwingUtil; -import com.threerings.micasa.Log; import com.threerings.micasa.lobby.LobbyConfig; import com.threerings.micasa.util.MiCasaContext; @@ -52,6 +51,8 @@ import com.threerings.parlor.game.data.GameConfig; import com.threerings.crowd.client.PlaceView; import com.threerings.crowd.data.PlaceObject; +import static com.threerings.micasa.Log.log; + /** * A view that displays the tables in a table lobby. It displays two * separate lists, one of tables being matchmade and another of games in @@ -103,7 +104,7 @@ public class TableListView extends JPanel _tableFigger = gconfig.createTableConfigurator(); if (_tableFigger == null) { - Log.warning("Game config has not been set up to work with " + + log.warning("Game config has not been set up to work with " + "tables: it needs to return non-null from " + "createTableConfigurator()."); // let's just wait until we throw an NPE below @@ -123,9 +124,8 @@ public class TableListView extends JPanel panel.add(_create, VGroupLayout.FIXED); } catch (Exception e) { - Log.warning("Unable to create configurator interface " + - "[config=" + gconfig + "]."); - Log.logStackTrace(e); + log.warning("Unable to create configurator interface " + + "[config=" + gconfig + "].", e); // stick something in the UI to let them know we're hosed panel.add(new JLabel("Aiya! Can't create tables. " + @@ -174,7 +174,7 @@ public class TableListView extends JPanel // documentation inherited public void tableAdded (Table table) { - Log.info("Table added [table=" + table + "]."); + log.info("Table added [table=" + table + "]."); // create a table item for this table and insert it into the // appropriate list @@ -186,12 +186,12 @@ public class TableListView extends JPanel // documentation inherited public void tableUpdated (Table table) { - Log.info("Table updated [table=" + table + "]."); + log.info("Table updated [table=" + table + "]."); // locate the table item associated with this table TableItem item = getTableItem(table.tableId); if (item == null) { - Log.warning("Received table updated notification for " + + log.warning("Received table updated notification for " + "unknown table [table=" + table + "]."); return; } @@ -212,12 +212,12 @@ public class TableListView extends JPanel // documentation inherited public void tableRemoved (int tableId) { - Log.info("Table removed [tableId=" + tableId + "]."); + log.info("Table removed [tableId=" + tableId + "]."); // locate the table item associated with this table TableItem item = getTableItem(tableId); if (item == null) { - Log.warning("Received table removed notification for " + + log.warning("Received table removed notification for " + "unknown table [tableId=" + tableId + "]."); return; } diff --git a/src/java/com/threerings/micasa/server/MiCasaServer.java b/src/java/com/threerings/micasa/server/MiCasaServer.java index cfa89888..c48a28fe 100644 --- a/src/java/com/threerings/micasa/server/MiCasaServer.java +++ b/src/java/com/threerings/micasa/server/MiCasaServer.java @@ -32,9 +32,10 @@ import com.threerings.crowd.server.CrowdServer; import com.threerings.parlor.server.ParlorManager; -import com.threerings.micasa.Log; import com.threerings.micasa.lobby.LobbyRegistry; +import static com.threerings.micasa.Log.log; + /** * This class is the main entry point and general organizer of everything * that goes on in the MiCasa game server process. @@ -72,7 +73,7 @@ public class MiCasaServer extends CrowdServer // initialize the lobby registry lobreg.init(invmgr); - Log.info("MiCasa server initialized."); + log.info("MiCasa server initialized."); } public static void main (String[] args) @@ -82,8 +83,7 @@ public class MiCasaServer extends CrowdServer server.init(); server.run(); } catch (Exception e) { - Log.warning("Unable to initialize server."); - Log.logStackTrace(e); + log.warning("Unable to initialize server.", e); } } } diff --git a/src/java/com/threerings/micasa/simulator/client/SimulatorApp.java b/src/java/com/threerings/micasa/simulator/client/SimulatorApp.java index 3f8c594f..75ff081e 100644 --- a/src/java/com/threerings/micasa/simulator/client/SimulatorApp.java +++ b/src/java/com/threerings/micasa/simulator/client/SimulatorApp.java @@ -34,11 +34,12 @@ import com.threerings.presents.client.Client; import com.threerings.presents.client.ClientAdapter; import com.threerings.presents.net.UsernamePasswordCreds; -import com.threerings.micasa.Log; import com.threerings.micasa.simulator.data.SimulatorInfo; import com.threerings.micasa.simulator.server.SimpleServer; import com.threerings.micasa.simulator.server.SimulatorServer; +import static com.threerings.micasa.Log.log; + /** * The simulator application is a test harness to facilitate development * and debugging of games. @@ -71,12 +72,12 @@ public class SimulatorApp try { run(); } catch (Exception e) { - Log.warning("Simulator initialization failed " + + log.warning("Simulator initialization failed " + "[e=" + e + "]."); } } public void requestFailed (Exception e) { - Log.warning("Simulator initialization failed [e=" + e + "]."); + log.warning("Simulator initialization failed [e=" + e + "]."); } }); @@ -119,13 +120,13 @@ public class SimulatorApp // start up the client Client client = _client.getParlorContext().getClient(); - Log.info("Connecting to localhost."); + log.info("Connecting to localhost."); client.setServer("localhost", Client.DEFAULT_SERVER_PORTS); // we want to exit when we logged off or failed to log on client.addClientObserver(new ClientAdapter() { public void clientFailedToLogon (Client c, Exception cause) { - Log.info("Client failed to logon: " + cause); + log.info("Client failed to logon: " + cause); System.exit(0); } public void clientDidLogoff (Client c) { @@ -171,8 +172,7 @@ public class SimulatorApp try { app.start(args); } catch (Exception e) { - Log.warning("Error starting up application."); - Log.logStackTrace(e); + log.warning("Error starting up application.", e); } } diff --git a/src/java/com/threerings/micasa/simulator/client/SimulatorController.java b/src/java/com/threerings/micasa/simulator/client/SimulatorController.java index 44fff48e..8c815aa3 100644 --- a/src/java/com/threerings/micasa/simulator/client/SimulatorController.java +++ b/src/java/com/threerings/micasa/simulator/client/SimulatorController.java @@ -32,9 +32,10 @@ import com.threerings.crowd.data.BodyObject; import com.threerings.parlor.game.data.GameConfig; import com.threerings.parlor.util.ParlorContext; -import com.threerings.micasa.Log; import com.threerings.micasa.simulator.data.SimulatorInfo; +import static com.threerings.micasa.Log.log; + /** * Responsible for top-level control of the simulator client user interface. */ @@ -73,7 +74,7 @@ public class SimulatorController extends Controller return true; } - Log.info("Unhandled action: " + action); + log.info("Unhandled action: " + action); return false; } @@ -86,7 +87,7 @@ public class SimulatorController extends Controller // documentation inherited public void clientDidLogon (Client client) { - Log.info("Client did logon [client=" + client + "]."); + log.info("Client did logon [client=" + client + "]."); // keep the body object around for stuff _body = (BodyObject)client.getClientObject(); @@ -110,7 +111,7 @@ public class SimulatorController extends Controller // straightaway } catch (Exception e) { - Log.warning("Failed to instantiate game config [class=" + _info.gameConfigClass + + log.warning("Failed to instantiate game config [class=" + _info.gameConfigClass + ", error=" + e + "]."); } } @@ -125,7 +126,7 @@ public class SimulatorController extends Controller // documentation inherited public void clientDidLogoff (Client client) { - Log.info("Client did logoff [client=" + client + "]."); + log.info("Client did logoff [client=" + client + "]."); } protected ParlorContext _ctx; diff --git a/src/java/com/threerings/micasa/simulator/server/SimulatorManager.java b/src/java/com/threerings/micasa/simulator/server/SimulatorManager.java index 092a9486..f227b5af 100644 --- a/src/java/com/threerings/micasa/simulator/server/SimulatorManager.java +++ b/src/java/com/threerings/micasa/simulator/server/SimulatorManager.java @@ -42,7 +42,7 @@ import com.threerings.parlor.game.data.GameConfig; import com.threerings.parlor.game.data.GameObject; import com.threerings.parlor.game.server.GameManager; -import com.threerings.micasa.Log; +import static com.threerings.micasa.Log.log; /** * The simulator manager is responsible for handling the simulator services on the server side. @@ -103,8 +103,7 @@ public class SimulatorManager _gmgr = (GameManager)_plreg.createPlace(config); } catch (Exception e) { - Log.warning("Unable to create game manager [e=" + e + "]."); - Log.logStackTrace(e); + log.warning("Unable to create game manager [e=" + e + "].", e); return; } @@ -136,7 +135,7 @@ public class SimulatorManager } } public void resolutionFailed (Name username, Exception cause) { - Log.warning("Unable to create simulant body object [error=" + cause + "]."); + log.warning("Unable to create simulant body object [error=" + cause + "]."); } }; @@ -160,7 +159,7 @@ public class SimulatorManager try { sim = (Simulant)Class.forName(_simClass).newInstance(); } catch (Exception e) { - Log.warning("Unable to create simulant " + + log.warning("Unable to create simulant " + "[class=" + _simClass + "]."); return; } @@ -177,7 +176,7 @@ public class SimulatorManager try { _plreg.locprov.moveTo(bobj, _gobj.getOid()); } catch (Exception e) { - Log.warning("Failed to move simulant into room " + + log.warning("Failed to move simulant into room " + "[e=" + e + "]."); return; } diff --git a/src/java/com/threerings/micasa/simulator/server/SimulatorProvider.java b/src/java/com/threerings/micasa/simulator/server/SimulatorProvider.java index 1375063e..e881d77c 100644 --- a/src/java/com/threerings/micasa/simulator/server/SimulatorProvider.java +++ b/src/java/com/threerings/micasa/simulator/server/SimulatorProvider.java @@ -27,7 +27,7 @@ import com.threerings.presents.server.InvocationProvider; import com.threerings.crowd.data.BodyObject; import com.threerings.parlor.game.data.GameConfig; -import com.threerings.micasa.Log; +import static com.threerings.micasa.Log.log; /** * The simulator provider handles game creation requests on the server @@ -50,7 +50,7 @@ public class SimulatorProvider public void createGame (ClientObject caller, GameConfig config, String simClass, int playerCount) { - Log.info("handleCreateGameRequest [caller=" + caller.who() + + log.info("handleCreateGameRequest [caller=" + caller.who() + ", config=" + config + ", simClass=" + simClass + ", playerCount=" + playerCount + "]."); diff --git a/src/java/com/threerings/parlor/Log.java b/src/java/com/threerings/parlor/Log.java index 3c7196e7..34142476 100644 --- a/src/java/com/threerings/parlor/Log.java +++ b/src/java/com/threerings/parlor/Log.java @@ -21,8 +21,7 @@ package com.threerings.parlor; -import java.util.logging.Level; -import java.util.logging.Logger; +import com.samskivert.util.Logger; /** * Contains a reference to the log object used by the Parlor services. @@ -30,30 +29,5 @@ import java.util.logging.Logger; public class Log { /** We dispatch our log messages through this logger. */ - public static Logger log = - Logger.getLogger("com.threerings.vilya.parlor"); - - /** Convenience function. */ - public static void debug (String message) - { - log.fine(message); - } - - /** Convenience function. */ - public static void info (String message) - { - log.info(message); - } - - /** Convenience function. */ - public static void warning (String message) - { - log.warning(message); - } - - /** Convenience function. */ - public static void logStackTrace (Throwable t) - { - log.log(Level.WARNING, t.getMessage(), t); - } + public static Logger log = Logger.getLogger("com.threerings.parlor"); } diff --git a/src/java/com/threerings/parlor/card/Log.java b/src/java/com/threerings/parlor/card/Log.java index c4a06732..feb133f2 100644 --- a/src/java/com/threerings/parlor/card/Log.java +++ b/src/java/com/threerings/parlor/card/Log.java @@ -21,36 +21,12 @@ package com.threerings.parlor.card; +import com.samskivert.util.Logger; + /** - * A placeholder class that contains a reference to the log object used by - * the Card services. + * Contains a reference to the log object used by the Card services. */ public class Log { - public static com.samskivert.util.Log log = - new com.samskivert.util.Log("card"); - - /** Convenience function. */ - public static void debug (String message) - { - log.debug(message); - } - - /** Convenience function. */ - public static void info (String message) - { - log.info(message); - } - - /** Convenience function. */ - public static void warning (String message) - { - log.warning(message); - } - - /** Convenience function. */ - public static void logStackTrace (Throwable t) - { - log.logStackTrace(com.samskivert.util.Log.WARNING, t); - } + public static Logger log = Logger.getLogger("com.threerings.parlor.card"); } diff --git a/src/java/com/threerings/parlor/card/client/CardGameController.java b/src/java/com/threerings/parlor/card/client/CardGameController.java index bda68e32..efeff325 100644 --- a/src/java/com/threerings/parlor/card/client/CardGameController.java +++ b/src/java/com/threerings/parlor/card/client/CardGameController.java @@ -25,13 +25,14 @@ import com.threerings.util.Name; import com.threerings.crowd.data.PlaceObject; -import com.threerings.parlor.card.Log; import com.threerings.parlor.card.data.Card; import com.threerings.parlor.card.data.CardCodes; import com.threerings.parlor.card.data.Hand; import com.threerings.parlor.game.client.GameController; import com.threerings.parlor.turn.client.TurnGameController; +import static com.threerings.parlor.card.Log.log; + /** * A controller class for card games. Handles common functions like * accepting dealt hands. @@ -44,7 +45,7 @@ public abstract class CardGameController extends GameController { if (_ctx.getClient().getClientObject().receivers.containsKey( CardGameDecoder.RECEIVER_CODE)) { - Log.warning("Yuh oh, we already have a card game receiver " + + log.warning("Yuh oh, we already have a card game receiver " + "registered and are trying for another...!"); Thread.dumpStack(); } diff --git a/src/java/com/threerings/parlor/card/client/CardPanel.java b/src/java/com/threerings/parlor/card/client/CardPanel.java index 9cad270f..972fdd8b 100644 --- a/src/java/com/threerings/parlor/card/client/CardPanel.java +++ b/src/java/com/threerings/parlor/card/client/CardPanel.java @@ -47,12 +47,13 @@ import com.threerings.media.util.Path; import com.threerings.media.util.PathSequence; import com.threerings.media.util.Pathable; -import com.threerings.parlor.card.Log; import com.threerings.parlor.card.data.Card; import com.threerings.parlor.card.data.CardCodes; import com.threerings.parlor.card.data.Deck; import com.threerings.parlor.card.data.Hand; +import static com.threerings.parlor.card.Log.log; + /** * Extends VirtualMediaPanel to provide services specific to rendering and manipulating playing * cards. diff --git a/src/java/com/threerings/parlor/card/server/CardGameManager.java b/src/java/com/threerings/parlor/card/server/CardGameManager.java index 50ed9818..7b10a14e 100644 --- a/src/java/com/threerings/parlor/card/server/CardGameManager.java +++ b/src/java/com/threerings/parlor/card/server/CardGameManager.java @@ -25,8 +25,6 @@ import com.threerings.crowd.data.BodyObject; import com.threerings.crowd.data.OccupantInfo; import com.threerings.crowd.server.OccupantOp; -import com.threerings.parlor.card.Log; - import com.threerings.parlor.card.data.Card; import com.threerings.parlor.card.data.CardCodes; import com.threerings.parlor.card.data.CardGameObject; @@ -42,6 +40,8 @@ import com.threerings.presents.dobj.MessageEvent; import com.threerings.presents.server.InvocationException; import com.threerings.presents.server.PresentsServer; +import static com.threerings.parlor.card.Log.log; + /** * A manager class for card games. Handles common functions like dealing * hands of cards to all players. diff --git a/src/java/com/threerings/parlor/card/trick/server/TrickCardGameManagerDelegate.java b/src/java/com/threerings/parlor/card/trick/server/TrickCardGameManagerDelegate.java index 7dac2020..1e4fcd7e 100644 --- a/src/java/com/threerings/parlor/card/trick/server/TrickCardGameManagerDelegate.java +++ b/src/java/com/threerings/parlor/card/trick/server/TrickCardGameManagerDelegate.java @@ -41,7 +41,6 @@ import com.threerings.crowd.server.PlaceManager; import com.threerings.parlor.turn.server.TurnGameManagerDelegate; -import com.threerings.parlor.card.Log; import com.threerings.parlor.card.data.Card; import com.threerings.parlor.card.data.CardGameObject; import com.threerings.parlor.card.data.Deck; @@ -51,6 +50,8 @@ import com.threerings.parlor.card.server.CardGameManager; import com.threerings.parlor.card.trick.data.TrickCardGameMarshaller; import com.threerings.parlor.card.trick.data.TrickCardGameObject; +import static com.threerings.parlor.card.Log.log; + /** * A card game manager delegate for trick-based card games, such as Spades and Hearts. */ @@ -216,14 +217,14 @@ public class TrickCardGameManagerDelegate extends TurnGameManagerDelegate // make sure they're actually a player int fromidx = _cgmgr.getPlayerIndex(client); if (fromidx == -1) { - Log.warning("Send request from non-player [username=" + + log.warning("Send request from non-player [username=" + ((BodyObject)client).who() + ", cards=" + StringUtil.toString(cards) + "]."); return; } // make sure they have the cards if (!_hands[fromidx].containsAll(cards)) { - Log.warning("Tried to send cards not held [username=" + + log.warning("Tried to send cards not held [username=" + ((BodyObject)client).who() + ", cards=" + StringUtil.toString(cards) + "]."); return; } @@ -254,14 +255,14 @@ public class TrickCardGameManagerDelegate extends TurnGameManagerDelegate // make sure their hand contains the specified card if (!_hands[pidx].contains(card)) { - Log.warning("Tried to play card not held [username=" + username + + log.warning("Tried to play card not held [username=" + username + ", card=" + card + "]."); return; } // make sure the card is legal to play if (!_trickCardGame.isCardPlayable(_hands[pidx], card)) { - Log.warning("Tried to play illegal card [username=" + username + + log.warning("Tried to play illegal card [username=" + username + ", card=" + card + "]."); return; } @@ -274,7 +275,7 @@ public class TrickCardGameManagerDelegate extends TurnGameManagerDelegate { // make sure the game is over if (_cardGame.state != CardGameObject.GAME_OVER) { - Log.warning("Tried to request rematch when game wasn't over " + + log.warning("Tried to request rematch when game wasn't over " + "[username=" + ((BodyObject)client).who() + "]."); return; } @@ -282,14 +283,14 @@ public class TrickCardGameManagerDelegate extends TurnGameManagerDelegate // make sure the requester is one of the players int pidx = _cgmgr.getPlayerIndex(client); if (pidx == -1) { - Log.warning("Rematch request from non-player [username=" + + log.warning("Rematch request from non-player [username=" + ((BodyObject)client).who() + "]."); return; } // make sure the player hasn't already requested if (_trickCardGame.getRematchRequests()[pidx] != TrickCardGameObject.NO_REQUEST) { - Log.warning("Repeated rematch request [username=" + ((BodyObject)client).who() + "]."); + log.warning("Repeated rematch request [username=" + ((BodyObject)client).who() + "]."); return; } diff --git a/src/java/com/threerings/parlor/client/Invitation.java b/src/java/com/threerings/parlor/client/Invitation.java index b740ecfc..ae6bce66 100644 --- a/src/java/com/threerings/parlor/client/Invitation.java +++ b/src/java/com/threerings/parlor/client/Invitation.java @@ -23,11 +23,12 @@ package com.threerings.parlor.client; import com.threerings.util.Name; -import com.threerings.parlor.Log; import com.threerings.parlor.data.ParlorCodes; import com.threerings.parlor.game.data.GameConfig; import com.threerings.parlor.util.ParlorContext; +import static com.threerings.parlor.Log.log; + /** * The invitation class is used to track information related to * outstanding invitations generated by or targeted to this client. @@ -151,7 +152,7 @@ public class Invitation { // make sure we have an observer to notify if (_observer == null) { - Log.warning("No observer registered for invitation " + + log.warning("No observer registered for invitation " + this + "."); return; } @@ -173,10 +174,9 @@ public class Invitation } } catch (Exception e) { - Log.warning("Invitation response observer choked on response " + + log.warning("Invitation response observer choked on response " + "[code=" + code + ", arg=" + arg + - ", invite=" + this + "]."); - Log.logStackTrace(e); + ", invite=" + this + "].", e); } // unless the invitation was countered, we can remove it from the diff --git a/src/java/com/threerings/parlor/client/ParlorDirector.java b/src/java/com/threerings/parlor/client/ParlorDirector.java index 5b6eb9cc..5bc99b50 100644 --- a/src/java/com/threerings/parlor/client/ParlorDirector.java +++ b/src/java/com/threerings/parlor/client/ParlorDirector.java @@ -30,11 +30,12 @@ import com.threerings.presents.client.BasicDirector; import com.threerings.presents.client.Client; import com.threerings.presents.client.InvocationService; -import com.threerings.parlor.Log; import com.threerings.parlor.data.ParlorCodes; import com.threerings.parlor.game.data.GameConfig; import com.threerings.parlor.util.ParlorContext; +import static com.threerings.parlor.Log.log; + /** * The parlor director manages the client side of the game configuration and matchmaking * processes. It is also the entity that is listening for game start notifications which it then @@ -132,7 +133,7 @@ public class ParlorDirector extends BasicDirector // documentation inherited from interface public void gameIsReady (int gameOid) { - Log.info("Handling game ready [goid=" + gameOid + "]."); + log.info("Handling game ready [goid=" + gameOid + "]."); // see what our observers have to say about it boolean handled = false; @@ -163,8 +164,7 @@ public class ParlorDirector extends BasicDirector _handler.invitationReceived(invite); } catch (Exception e) { - Log.warning("Invitation handler choked on invite notification " + invite + "."); - Log.logStackTrace(e); + log.warning("Invitation handler choked on invite notification " + invite + ".", e); } } @@ -174,7 +174,7 @@ public class ParlorDirector extends BasicDirector // look up the invitation record for this invitation Invitation invite = (Invitation)_pendingInvites.get(remoteId); if (invite == null) { - Log.warning("Have no record of invitation for which we received a response?! " + + log.warning("Have no record of invitation for which we received a response?! " + "[remoteId=" + remoteId + ", code=" + code + ", arg=" + arg + "]."); } else { diff --git a/src/java/com/threerings/parlor/client/TableDirector.java b/src/java/com/threerings/parlor/client/TableDirector.java index 5a1fa687..d3945056 100644 --- a/src/java/com/threerings/parlor/client/TableDirector.java +++ b/src/java/com/threerings/parlor/client/TableDirector.java @@ -35,13 +35,14 @@ import com.threerings.presents.dobj.SetListener; import com.threerings.crowd.data.BodyObject; -import com.threerings.parlor.Log; import com.threerings.parlor.data.Table; import com.threerings.parlor.data.TableConfig; import com.threerings.parlor.data.TableLobbyObject; import com.threerings.parlor.game.data.GameConfig; import com.threerings.parlor.util.ParlorContext; +import static com.threerings.parlor.Log.log; + /** * As tables are created and managed within the scope of a place (a lobby), we want to fold the * table management functionality into the standard hierarchy of place controllers that deal with @@ -146,14 +147,14 @@ public class TableDirector extends BasicDirector { // if we're already in a table, refuse the request if (_ourTable != null) { - Log.warning("Ignoring request to create table as we're already in a table " + + log.warning("Ignoring request to create table as we're already in a table " + "[table=" + _ourTable + "]."); return; } // make sure we're currently in a place if (_tlobj == null) { - Log.warning("Requested to create a table but we're not currently in a place " + + log.warning("Requested to create a table but we're not currently in a place " + "[config=" + config + "]."); return; } @@ -170,14 +171,14 @@ public class TableDirector extends BasicDirector { // if we're already in a table, refuse the request if (_ourTable != null) { - Log.warning("Ignoring request to join table as we're already in a table " + + log.warning("Ignoring request to join table as we're already in a table " + "[table=" + _ourTable + "]."); return; } // make sure we're currently in a place if (_tlobj == null) { - Log.warning("Requested to join a table but we're not currently in a place " + + log.warning("Requested to join a table but we're not currently in a place " + "[tableId=" + tableId + "]."); return; } @@ -194,7 +195,7 @@ public class TableDirector extends BasicDirector { // make sure we're currently in a place if (_tlobj == null) { - Log.warning("Requested to leave a table but we're not currently in a place " + + log.warning("Requested to leave a table but we're not currently in a place " + "[tableId=" + tableId + "]."); return; } @@ -210,7 +211,7 @@ public class TableDirector extends BasicDirector public void startTableNow (int tableId) { if (_tlobj == null) { - Log.warning("Requested to start a table but we're not currently in a place " + + log.warning("Requested to start a table but we're not currently in a place " + "[tableId=" + tableId + "]."); return; } @@ -270,13 +271,13 @@ public class TableDirector extends BasicDirector int tableId = (Integer)result; if (_tlobj == null) { // we've left, it's none of our concern anymore - Log.info("Table created, but no lobby. [tableId=" + tableId + "]."); + log.info("Table created, but no lobby. [tableId=" + tableId + "]."); return; } Table table = (Table) _tlobj.getTables().get(tableId); if (table == null) { - Log.warning("Table created, but where is it? [tableId=" + tableId + "]"); + log.warning("Table created, but where is it? [tableId=" + tableId + "]"); return; } @@ -289,7 +290,7 @@ public class TableDirector extends BasicDirector // from interface TableService.ResultListener public void requestFailed (String reason) { - Log.warning("Table action failed [reason=" + reason + "]."); + log.warning("Table action failed [reason=" + reason + "]."); } /** diff --git a/src/java/com/threerings/parlor/game/client/GameController.java b/src/java/com/threerings/parlor/game/client/GameController.java index 603d1791..4ba00cf1 100644 --- a/src/java/com/threerings/parlor/game/client/GameController.java +++ b/src/java/com/threerings/parlor/game/client/GameController.java @@ -33,12 +33,13 @@ import com.threerings.crowd.data.PlaceConfig; import com.threerings.crowd.data.PlaceObject; import com.threerings.crowd.util.CrowdContext; -import com.threerings.parlor.Log; import com.threerings.parlor.game.data.GameCodes; import com.threerings.parlor.game.data.GameConfig; import com.threerings.parlor.game.data.GameObject; import com.threerings.parlor.util.ParlorContext; +import static com.threerings.parlor.Log.log; + /** * The game controller manages the flow and control of a game on the client side. This class serves * as the root of a hierarchy of controller classes that aim to provide functionality shared @@ -94,7 +95,7 @@ public abstract class GameController extends PlaceController // we don't want to claim to be finished until any derived classes that overrode this // method have executed, so we'll queue up a runnable here that will let the game manager // know that we're ready on the next pass through the distributed event loop - Log.info("Entering game " + _gobj.which() + "."); + log.info("Entering game " + _gobj.which() + "."); if (_gobj.getPlayerIndex(bobj.getVisibleName()) != -1) { _ctx.getClient().getRunQueue().postRunnable(new Runnable() { public void run () { @@ -193,7 +194,7 @@ public abstract class GameController extends PlaceController if (event.getName().equals(GameObject.STATE)) { int newState = event.getIntValue(); if (!stateDidChange(newState)) { - Log.warning("Game transitioned to unknown state [gobj=" + _gobj + + log.warning("Game transitioned to unknown state [gobj=" + _gobj + ", state=" + newState + "]."); } } @@ -228,7 +229,7 @@ public abstract class GameController extends PlaceController */ protected void playerReady () { - Log.info("Reporting ready " + _gobj.which() + "."); + log.info("Reporting ready " + _gobj.which() + "."); _gobj.manager.invoke("playerReady"); } @@ -239,7 +240,7 @@ public abstract class GameController extends PlaceController protected void gameDidStart () { if (_gobj == null) { - Log.info("Received gameDidStart() after leaving game room."); + log.info("Received gameDidStart() after leaving game room."); return; } diff --git a/src/java/com/threerings/parlor/game/server/GameManager.java b/src/java/com/threerings/parlor/game/server/GameManager.java index d854c024..a36c099a 100644 --- a/src/java/com/threerings/parlor/game/server/GameManager.java +++ b/src/java/com/threerings/parlor/game/server/GameManager.java @@ -454,7 +454,7 @@ public class GameManager extends PlaceManager boolean result = startGame(); // TEMP: track down weirdness if (!result && !_postponedStart) { - log.log(Level.WARNING, "First call to startGame: ", firstCall); + log.warning("First call to startGame: ", firstCall); } // End: temp } @@ -1286,7 +1286,7 @@ public class GameManager extends PlaceManager try { gmgr.tick(now); } catch (Exception e) { - log.log(Level.WARNING, "Game manager choked during tick [gmgr=" + gmgr + "].", e); + log.warning("Game manager choked during tick [gmgr=" + gmgr + "].", e); } } } diff --git a/src/java/com/threerings/parlor/server/ParlorManager.java b/src/java/com/threerings/parlor/server/ParlorManager.java index 5b9364de..fdc7c72c 100644 --- a/src/java/com/threerings/parlor/server/ParlorManager.java +++ b/src/java/com/threerings/parlor/server/ParlorManager.java @@ -32,12 +32,13 @@ import com.threerings.crowd.data.BodyObject; import com.threerings.crowd.server.CrowdServer; import com.threerings.crowd.server.PlaceRegistry; -import com.threerings.parlor.Log; import com.threerings.parlor.client.ParlorService; import com.threerings.parlor.data.ParlorCodes; import com.threerings.parlor.data.TableConfig; import com.threerings.parlor.game.data.GameConfig; +import static com.threerings.parlor.Log.log; + /** * The parlor manager is responsible for the parlor services in aggregate. This includes * maintaining the registry of active games, handling the necessary coordination for the @@ -107,7 +108,7 @@ public class ParlorManager { BodyObject user = (BodyObject)caller; - Log.debug("Processing start solitaire [caller=" + user.who() + ", config=" + config + "]."); + log.debug("Processing start solitaire [caller=" + user.who() + ", config=" + config + "]."); try { // just this fellow will be playing @@ -123,9 +124,8 @@ public class ParlorManager listener.requestProcessed(); } catch (InstantiationException ie) { - Log.warning("Error instantiating game manager " + - "[for=" + caller.who() + ", config=" + config + "]."); - Log.logStackTrace(ie); + log.warning("Error instantiating game manager " + + "[for=" + caller.who() + ", config=" + config + "].", ie); throw new InvocationException(INTERNAL_ERROR); } } @@ -183,7 +183,7 @@ public class ParlorManager // look up the invitation Invitation invite = (Invitation)_invites.get(inviteId); if (invite == null) { - Log.warning("Requested to respond to non-existent invitation " + + log.warning("Requested to respond to non-existent invitation " + "[source=" + source + ", inviteId=" + inviteId + ", code=" + code + ", arg=" + arg + "]."); return; @@ -191,7 +191,7 @@ public class ParlorManager // make sure this response came from the proper person if (source != invite.invitee) { - Log.warning("Got response from non-invitee [source=" + source + + log.warning("Got response from non-invitee [source=" + source + ", invite=" + invite + ", code=" + code + ", arg=" + arg + "]."); return; @@ -221,7 +221,7 @@ public class ParlorManager break; default: - Log.warning("Requested to respond to invitation with unknown response code " + + log.warning("Requested to respond to invitation with unknown response code " + "[source=" + source + ", invite=" + invite + ", code=" + code + ", arg=" + arg + "]."); break; @@ -245,7 +245,7 @@ public class ParlorManager protected void processAcceptedInvitation (Invitation invite) { try { - Log.info("Creating game manager [invite=" + invite + "]."); + log.info("Creating game manager [invite=" + invite + "]."); // configure the game config with the player info invite.config.players = new Name[] { invite.invitee.getVisibleName(), @@ -256,8 +256,7 @@ public class ParlorManager createGameManager(invite.config); } catch (Exception e) { - Log.warning("Unable to create game manager [invite=" + invite + ", error=" + e + "]."); - Log.logStackTrace(e); + log.warning("Unable to create game manager [invite=" + invite + "].", e); } } diff --git a/src/java/com/threerings/parlor/server/TableManager.java b/src/java/com/threerings/parlor/server/TableManager.java index 9e96a7d7..a75a4dfc 100644 --- a/src/java/com/threerings/parlor/server/TableManager.java +++ b/src/java/com/threerings/parlor/server/TableManager.java @@ -47,7 +47,6 @@ import com.threerings.crowd.data.OccupantInfo; import com.threerings.crowd.data.PlaceObject; import com.threerings.crowd.server.CrowdServer; -import com.threerings.parlor.Log; import com.threerings.parlor.client.TableService; import com.threerings.parlor.data.ParlorCodes; import com.threerings.parlor.data.Table; @@ -58,6 +57,8 @@ import com.threerings.parlor.game.data.GameConfig; import com.threerings.parlor.game.data.GameObject; import com.threerings.parlor.game.server.GameManager; +import static com.threerings.parlor.Log.log; + /** * A table manager can be used by a place manager (or other entity) to take care of the management * of a table matchmaking service on a particular distributed object. @@ -126,7 +127,7 @@ public class TableManager try { table = _tableClass.newInstance(); } catch (Exception e) { - Log.warning("Table.newInstance() failde [class=" + _tableClass + ", e=" + e + "]."); + log.warning("Table.newInstance() failde [class=" + _tableClass + ", e=" + e + "]."); throw new InvocationException(INTERNAL_ERROR); } table.init(_dobj.getOid(), tableConfig, config); @@ -136,7 +137,7 @@ public class TableManager int cpos = (config.ais == null) ? 0 : config.ais.length; String error = table.setPlayer(cpos, creator); if (error != null) { - Log.warning("Unable to add creator to position zero of table!? [table=" + table + + log.warning("Unable to add creator to position zero of table!? [table=" + table + ", creator=" + creator + ", error=" + error + "]."); // bail out now and abort the table creation process throw new InvocationException(error); @@ -171,7 +172,7 @@ public class TableManager // in which they are requesting to create a table if (_dobj instanceof PlaceObject && !((PlaceObject)_dobj).occupants.contains(creator.getOid())) { - Log.warning("Requested to create a table in a place not occupied by the creator " + + log.warning("Requested to create a table in a place not occupied by the creator " + "[creator=" + creator + ", ploid=" + _dobj.getOid() + "]."); throw new InvocationException(INTERNAL_ERROR); } @@ -240,7 +241,7 @@ public class TableManager // remove the mapping from this user to the table if (null == notePlayerRemoved(leaver.getOid(), leaver)) { - Log.warning("No body to table mapping to clear? [leaver=" + leaver.who() + + log.warning("No body to table mapping to clear? [leaver=" + leaver.who() + ", table=" + table + "]."); } @@ -343,7 +344,7 @@ public class TableManager return gobj.getOid(); } catch (Throwable t) { - Log.warning("Failed to create manager for game [config=" + table.config + "]: " + t); + log.warning("Failed to create manager for game [config=" + table.config + "]: " + t); throw new InvocationException(INTERNAL_ERROR); } } @@ -416,7 +417,7 @@ public class TableManager if (table != null) { purgeTable(table); } else { - Log.warning("Requested to unmap table that wasn't mapped [gameOid=" + gameOid + "]."); + log.warning("Requested to unmap table that wasn't mapped [gameOid=" + gameOid + "]."); } } @@ -432,7 +433,7 @@ public class TableManager Table table = _goidMap.get(gameOid); if (table == null) { - Log.warning("Unable to find table for running game [gameOid=" + gameOid + "]."); + log.warning("Unable to find table for running game [gameOid=" + gameOid + "]."); return; } @@ -456,7 +457,7 @@ public class TableManager // remove this player from the table if (!pender.clearPlayerByOid(bodyOid)) { - Log.warning("Attempt to remove body from mapped table failed [table=" + pender + + log.warning("Attempt to remove body from mapped table failed [table=" + pender + ", bodyOid=" + bodyOid + "]."); return; } diff --git a/src/java/com/threerings/parlor/turn/server/TurnGameManagerDelegate.java b/src/java/com/threerings/parlor/turn/server/TurnGameManagerDelegate.java index 975cd4bf..fc80027f 100644 --- a/src/java/com/threerings/parlor/turn/server/TurnGameManagerDelegate.java +++ b/src/java/com/threerings/parlor/turn/server/TurnGameManagerDelegate.java @@ -27,12 +27,13 @@ import com.threerings.util.Name; import com.threerings.crowd.data.PlaceObject; import com.threerings.crowd.server.PlaceManager; -import com.threerings.parlor.Log; import com.threerings.parlor.game.server.GameManager; import com.threerings.parlor.game.server.GameManagerDelegate; import com.threerings.parlor.turn.data.TurnGameObject; +import static com.threerings.parlor.Log.log; + /** * Performs the server-side turn-based game processing for a turn based game. Game managers which * wish to make use of the turn services must implement {@link TurnGameManager} and either create @@ -96,7 +97,7 @@ public class TurnGameManagerDelegate extends GameManagerDelegate { // sanity check if (_turnIdx < 0 || _turnIdx >= _turnGame.getPlayers().length) { - Log.warning("startTurn() called with invalid turn index [game=" + where() + + log.warning("startTurn() called with invalid turn index [game=" + where() + ", turnIdx=" + _turnIdx + "]."); // abort, abort return; @@ -105,7 +106,7 @@ public class TurnGameManagerDelegate extends GameManagerDelegate // get the player name and sanity-check again Name name = _tgmgr.getPlayerName(_turnIdx); if (name == null) { - Log.warning("startTurn() called with invalid player [game=" + where() + + log.warning("startTurn() called with invalid player [game=" + where() + ", turnIdx=" + _turnIdx + "]."); return; } @@ -218,7 +219,7 @@ public class TurnGameManagerDelegate extends GameManagerDelegate if (_turnIdx == oturnIdx) { // if we've wrapped all the way around, stop where we are even if the current // player is not active. - Log.warning("1 or less active players. Unable to properly change turn. " + + log.warning("1 or less active players. Unable to properly change turn. " + "[game=" + where() + "]."); break; } @@ -236,7 +237,7 @@ public class TurnGameManagerDelegate extends GameManagerDelegate while (!_tgmgr.isActivePlayer(_turnIdx)) { _turnIdx = (_turnIdx + 1) % size; if (_turnIdx == firstPick) { - Log.warning("No players eligible for randomly-assigned turn. Choking. " + + log.warning("No players eligible for randomly-assigned turn. Choking. " + "[game=" + where() + "]."); return; } diff --git a/src/java/com/threerings/puzzle/Log.java b/src/java/com/threerings/puzzle/Log.java index 51928763..3806d628 100644 --- a/src/java/com/threerings/puzzle/Log.java +++ b/src/java/com/threerings/puzzle/Log.java @@ -21,36 +21,12 @@ package com.threerings.puzzle; +import com.samskivert.util.Logger; + /** - * A placeholder class that contains a reference to the log object used by - * this package. + * Contains a reference to the log object used by this package. */ public class Log { - public static com.samskivert.util.Log log = - new com.samskivert.util.Log("puzzle"); - - /** Convenience function. */ - public static void debug (String message) - { - log.debug(message); - } - - /** Convenience function. */ - public static void info (String message) - { - log.info(message); - } - - /** Convenience function. */ - public static void warning (String message) - { - log.warning(message); - } - - /** Convenience function. */ - public static void logStackTrace (Throwable t) - { - log.logStackTrace(com.samskivert.util.Log.WARNING, t); - } + public static Logger log = Logger.getLogger("com.threerings.puzzle"); } diff --git a/src/java/com/threerings/puzzle/client/PuzzleBoardView.java b/src/java/com/threerings/puzzle/client/PuzzleBoardView.java index 79785dc3..4a2625cc 100644 --- a/src/java/com/threerings/puzzle/client/PuzzleBoardView.java +++ b/src/java/com/threerings/puzzle/client/PuzzleBoardView.java @@ -46,11 +46,12 @@ import com.threerings.media.sprite.Sprite; import com.threerings.parlor.game.data.GameConfig; import com.threerings.parlor.media.ScoreAnimation; -import com.threerings.puzzle.Log; import com.threerings.puzzle.data.Board; import com.threerings.puzzle.data.PuzzleCodes; import com.threerings.puzzle.util.PuzzleContext; +import static com.threerings.puzzle.Log.log; + /** * The puzzle board view displays a view of a puzzle game. */ @@ -160,7 +161,7 @@ public abstract class PuzzleBoardView extends VirtualMediaPanel protected void animationFinished (Animation anim) { if (DEBUG_ACTION) { - Log.info("Animation cleared " + StringUtil.shortClassName(anim) + + log.info("Animation cleared " + StringUtil.shortClassName(anim) + ":" + _actionAnims.contains(anim)); } @@ -194,7 +195,7 @@ public abstract class PuzzleBoardView extends VirtualMediaPanel super.removeSprite(sprite); if (DEBUG_ACTION) { - Log.info("Sprite cleared " + StringUtil.shortClassName(sprite) + + log.info("Sprite cleared " + StringUtil.shortClassName(sprite) + ":" + _actionSprites.contains(sprite)); } @@ -253,7 +254,7 @@ public abstract class PuzzleBoardView extends VirtualMediaPanel return StringUtil.shortClassName(obj); } }; - Log.info("Board contents [board=" + StringUtil.shortClassName(this) + + log.info("Board contents [board=" + StringUtil.shortClassName(this) + ", sprites=" + StringUtil.listToString(_actionSprites, fmt) + ", anims=" + StringUtil.listToString(_actionAnims, fmt) + "]."); @@ -348,7 +349,7 @@ public abstract class PuzzleBoardView extends VirtualMediaPanel protected void maybeFireCleared () { if (DEBUG_ACTION) { - Log.info("Maybe firing cleared " + + log.info("Maybe firing cleared " + getActionCount() + ":" + isShowing()); } if (getActionCount() == 0) { diff --git a/src/java/com/threerings/puzzle/client/PuzzleController.java b/src/java/com/threerings/puzzle/client/PuzzleController.java index f90f45ca..cc12a5d7 100644 --- a/src/java/com/threerings/puzzle/client/PuzzleController.java +++ b/src/java/com/threerings/puzzle/client/PuzzleController.java @@ -50,12 +50,13 @@ import com.threerings.crowd.data.PlaceObject; import com.threerings.parlor.game.client.GameController; import com.threerings.parlor.game.data.GameObject; -import com.threerings.puzzle.Log; import com.threerings.puzzle.data.Board; import com.threerings.puzzle.data.PuzzleCodes; import com.threerings.puzzle.data.PuzzleObject; import com.threerings.puzzle.util.PuzzleContext; +import static com.threerings.puzzle.Log.log; + /** * The puzzle game controller handles logical actions for a puzzle game. */ @@ -163,7 +164,7 @@ public abstract class PuzzleController extends GameController // if we're moving focus to chat.. if (chatting) { if (_unpauser != null) { - Log.warning("Huh? Already have a mouse unpauser?"); + log.warning("Huh? Already have a mouse unpauser?"); _unpauser.release(); } _unpauser = new Unpauser(_panel); @@ -407,26 +408,26 @@ public abstract class PuzzleController extends GameController // refuse to start the action if our puzzle view is hidden if (_pidx != -1 && !_panel.getBoardView().isShowing()) { - Log.warning("Refusing to start action on hidden puzzle."); + log.warning("Refusing to start action on hidden puzzle."); Thread.dumpStack(); return; } // refuse to start the action if it's already going if (_astate != ACTION_CLEARED) { - Log.warning("Action state inappropriate for startAction() " + + log.warning("Action state inappropriate for startAction() " + "[astate=" + _astate + "]."); Thread.dumpStack(); return; } if (isChatting() && supportsActionPause()) { - Log.info("Not starting action, player is chatting in a puzzle " + + log.info("Not starting action, player is chatting in a puzzle " + "that supports pausing the action."); return; } - Log.debug("Starting puzzle action."); + log.debug("Starting puzzle action."); // register the game progress updater; it may already be updated // because we can cycle through clearing the action and starting @@ -498,7 +499,7 @@ public abstract class PuzzleController extends GameController return; } - Log.debug("Attempting to clear puzzle action."); + log.debug("Attempting to clear puzzle action."); // put ourselves into a pending clear state and attempt to clear // the action @@ -527,13 +528,13 @@ public abstract class PuzzleController extends GameController // if the action is already ended, fire this pender immediately if (_astate == ACTION_CLEARED) { if (pender.actionCleared() == ClearPender.RESTART_ACTION) { - Log.debug("Restarting action at behest of pender " + + log.debug("Restarting action at behest of pender " + pender + "."); startAction(); } } else { - Log.debug("Queueing action pender " + pender + "."); + log.debug("Queueing action pender " + pender + "."); _clearPenders.add(pender); } } @@ -593,7 +594,7 @@ public abstract class PuzzleController extends GameController */ protected void actuallyClearAction () { - Log.debug("Actually clearing action."); + log.debug("Actually clearing action."); // make a note that we've cleared the action _astate = ACTION_CLEARED; @@ -617,8 +618,7 @@ public abstract class PuzzleController extends GameController try { actionWasCleared(); } catch (Exception e) { - Log.warning("Choked in actionWasCleared"); - Log.logStackTrace(e); + log.warning("Choked in actionWasCleared", e); } // notify any penders that the action has cleared @@ -734,7 +734,7 @@ public abstract class PuzzleController extends GameController { // make sure they don't queue things up at strange times if (_puzobj.state != PuzzleObject.IN_PLAY) { - Log.warning("Rejecting progress event; game not in play " + + log.warning("Rejecting progress event; game not in play " + "[puzobj=" + _puzobj.which() + ", event=" + event + "]."); return; @@ -744,7 +744,7 @@ public abstract class PuzzleController extends GameController if (isSyncingBoards()) { _states.add((board == null) ? null : board.clone()); if (board == null) { - Log.warning("Added progress event with no associated board " + + log.warning("Added progress event with no associated board " + "state, server will not be able to ensure " + "board state synchronization."); } diff --git a/src/java/com/threerings/puzzle/client/PuzzlePanel.java b/src/java/com/threerings/puzzle/client/PuzzlePanel.java index 68aa0b0e..21a26fd6 100644 --- a/src/java/com/threerings/puzzle/client/PuzzlePanel.java +++ b/src/java/com/threerings/puzzle/client/PuzzlePanel.java @@ -37,11 +37,12 @@ import com.threerings.crowd.data.PlaceObject; import com.threerings.parlor.game.data.GameConfig; import com.threerings.parlor.util.RobotPlayer; -import com.threerings.puzzle.Log; import com.threerings.puzzle.data.PuzzleCodes; import com.threerings.puzzle.data.PuzzleGameCodes; import com.threerings.puzzle.util.PuzzleContext; +import static com.threerings.puzzle.Log.log; + /** * The puzzle panel class should be extended by classes that provide a * view for a puzzle game. The {@link PuzzleController} calls these @@ -108,7 +109,7 @@ public abstract class PuzzlePanel extends JPanel { // bail if we've already got an overlay if (_opanel != null) { - Log.info("Refusing to push overlay panel, we've already got one " + + log.info("Refusing to push overlay panel, we've already got one " + "[opanel=" + _opanel + ", npanel=" + opanel + "]."); return false; } diff --git a/src/java/com/threerings/puzzle/drop/client/DropBoardView.java b/src/java/com/threerings/puzzle/drop/client/DropBoardView.java index 5634cbe1..0a1ffc8f 100644 --- a/src/java/com/threerings/puzzle/drop/client/DropBoardView.java +++ b/src/java/com/threerings/puzzle/drop/client/DropBoardView.java @@ -40,7 +40,6 @@ import com.threerings.media.util.Path; import com.threerings.parlor.game.data.GameConfig; import com.threerings.parlor.media.ScoreAnimation; -import com.threerings.puzzle.Log; import com.threerings.puzzle.client.PuzzleBoardView; import com.threerings.puzzle.data.Board; import com.threerings.puzzle.util.PuzzleContext; @@ -49,6 +48,8 @@ import com.threerings.puzzle.drop.data.DropBoard; import com.threerings.puzzle.drop.data.DropConfig; import com.threerings.puzzle.drop.data.DropPieceCodes; +import static com.threerings.puzzle.Log.log; + /** * The drop board view displays a drop puzzle game in progress for a * single player. @@ -141,7 +142,7 @@ public abstract class DropBoardView extends PuzzleBoardView public void createPiece (int piece, int sx, int sy) { if (sx < 0 || sy < 0 || sx >= _bwid || sy >= _bhei) { - Log.warning("Requested to create piece in invalid location " + + log.warning("Requested to create piece in invalid location " + "[sx=" + sx + ", sy=" + sy + "]."); Thread.dumpStack(); return; @@ -171,7 +172,7 @@ public abstract class DropBoardView extends PuzzleBoardView public void updatePiece (int piece, int sx, int sy) { if (sx < 0 || sy < 0 || sx >= _bwid || sy >= _bhei) { - Log.warning("Requested to update piece in invalid location " + + log.warning("Requested to update piece in invalid location " + "[sx=" + sx + ", sy=" + sy + "]."); Thread.dumpStack(); return; @@ -192,7 +193,7 @@ public abstract class DropBoardView extends PuzzleBoardView long duration) { if (tx < 0 || ty < 0 || tx >= _bwid || ty >= _bhei) { - Log.warning("Requested to create and move piece to invalid " + + log.warning("Requested to create and move piece to invalid " + "location [tx=" + tx + ", ty=" + ty + "]."); Thread.dumpStack(); return; @@ -224,7 +225,7 @@ public abstract class DropBoardView extends PuzzleBoardView int spos = sy * _bwid + sx; Sprite piece = _pieces[spos]; if (piece == null) { - Log.warning("Missing source sprite for drop [sx=" + sx + + log.warning("Missing source sprite for drop [sx=" + sx + ", sy=" + sy + ", tx=" + tx + ", ty=" + ty + "]."); return null; } @@ -247,11 +248,9 @@ public abstract class DropBoardView extends PuzzleBoardView if (sx == tx && sy == ty) { int tpos = ty * _bwid + tx; if (_pieces[tpos] != null) { - Log.warning("Zoiks! Asked to add a piece where we already " + + log.warning("Zoiks! Asked to add a piece where we already " + "have one [sx=" + sx + ", sy=" + sy + - ", tx=" + tx + ", ty=" + ty + "]."); - Log.logStackTrace(where); - return; + ", tx=" + tx + ", ty=" + ty + "].", where); } _pieces[tpos] = piece; piece.setLocation(start.x, start.y); @@ -269,10 +268,9 @@ public abstract class DropBoardView extends PuzzleBoardView public void pathCompleted (Sprite sprite, Path path, long when) { sprite.removeSpriteObserver(this); if (_pieces[tpos] != null) { - Log.warning("Oh god, we're dropping onto another piece " + + log.warning("Oh god, we're dropping onto another piece " + "[sx=" + sx + ", sy=" + sy + - ", tx=" + tx + ", ty=" + ty + "]."); - Log.logStackTrace(where); + ", tx=" + tx + ", ty=" + ty + "].", where); return; } _pieces[tpos] = sprite; diff --git a/src/java/com/threerings/puzzle/drop/client/DropControllerDelegate.java b/src/java/com/threerings/puzzle/drop/client/DropControllerDelegate.java index 3cea899a..99fc5998 100644 --- a/src/java/com/threerings/puzzle/drop/client/DropControllerDelegate.java +++ b/src/java/com/threerings/puzzle/drop/client/DropControllerDelegate.java @@ -39,7 +39,6 @@ import com.threerings.crowd.util.CrowdContext; import com.threerings.puzzle.util.PuzzleContext; -import com.threerings.puzzle.Log; import com.threerings.puzzle.client.PuzzleController; import com.threerings.puzzle.client.PuzzleControllerDelegate; import com.threerings.puzzle.client.PuzzlePanel; @@ -55,6 +54,8 @@ import com.threerings.puzzle.drop.util.PieceDropLogic; import com.threerings.puzzle.drop.util.PieceDropper.PieceDropInfo; import com.threerings.puzzle.drop.util.PieceDropper; +import static com.threerings.puzzle.Log.log; + /** * Games that wish to make use of the drop puzzle services will need to * create an extension of this delegate class, customizing it for their @@ -187,7 +188,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate // it on its merry way once more if (_blocksprite != null) { long delta = _dview.getTimeStamp() - _blockStamp; - Log.info("Restarting drop sprite [delta=" + delta + "]."); + log.info("Restarting drop sprite [delta=" + delta + "]."); _blocksprite.fastForward(delta); _blockStamp = 0L; _dview.addSprite(_blocksprite); @@ -196,7 +197,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate // bouncing, we need to land the block to get things going // again if (_blocksprite.isBouncing()) { - Log.info("Ended on a bounce, landing the block and " + + log.info("Ended on a bounce, landing the block and " + "starting things up."); checkBlockLanded("bounced", true, true); } @@ -210,7 +211,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate protected boolean canClearAction () { if (!_stable) { - Log.info("Rejecting canClear() request because not stable."); + log.info("Rejecting canClear() request because not stable."); } return _stable && super.canClearAction(); } @@ -442,7 +443,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate protected void dropNextBlock () { if (_blocksprite != null || !_ctrl.hasAction()) { - Log.info("Not dropping block [bs=" + (_blocksprite != null) + + log.info("Not dropping block [bs=" + (_blocksprite != null) + ", action=" + _ctrl.hasAction() + "]."); return; } @@ -674,7 +675,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate if (_dboard.isValidDrop(rows, cols, pctdone)) { if (commit) { - Log.info("Not valid drop [source=" + source + + log.info("Not valid drop [source=" + source + ", commit=" + commit + ", atTop=" + atTop + ", pctdone=" + pctdone + "]."); } @@ -698,7 +699,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate // a valid position, and that we aren't somehow // overwriting an existing piece if (col < 0 || col >= _bwid || row >= _bhei) { - Log.warning("Placing drop block piece outside board " + + log.warning("Placing drop block piece outside board " + "bounds!? [x=" + col + ", y=" + row + ", pidx=" + ii + ", blocksprite=" + _blocksprite + "]."); @@ -707,7 +708,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate } else { int cpiece = _dboard.getPiece(col, row); if (cpiece != PIECE_NONE) { - Log.warning("Placing drop block piece onto " + + log.warning("Placing drop block piece onto " + "occupied board position!? [x=" + col + ", y=" + row + ", pidx=" + ii + ", blocksprite=" + _blocksprite + "]."); @@ -724,7 +725,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate if (DEBUG_PUZZLE && error) { _dboard.dump(); - Log.warning("Bailing out in a flaming pyre of glory."); + log.warning("Bailing out in a flaming pyre of glory."); System.exit(0); } } @@ -910,7 +911,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate boolean evolving = evolveBoard(); boolean debug = false; if (debug) { - Log.info("Evolved board [evolving=" + evolving + "]."); + log.info("Evolved board [evolving=" + evolving + "]."); } // if we're no longer evolving and the action has not ended, go @@ -922,7 +923,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate // this will trigger further puzzle activity if (debug) { - Log.info("Board did stabilize"); + log.info("Board did stabilize"); } boardDidStabilize(); @@ -930,7 +931,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate // evolution, that it will now be cleared if (!_ctrl.hasAction()) { if (debug) { - Log.info("Maybe clearing action."); + log.info("Maybe clearing action."); } maybeClearAction(); } @@ -1067,7 +1068,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate unstabilizeBoard(); } else { - Log.debug("Sticking fork in it [risers=" + + log.debug("Sticking fork in it [risers=" + StringUtil.toString(pieces) + "."); // let the controller know that we're done for diff --git a/src/java/com/threerings/puzzle/drop/client/DropSprite.java b/src/java/com/threerings/puzzle/drop/client/DropSprite.java index 5bcbe229..a154aebf 100644 --- a/src/java/com/threerings/puzzle/drop/client/DropSprite.java +++ b/src/java/com/threerings/puzzle/drop/client/DropSprite.java @@ -32,7 +32,7 @@ import com.threerings.util.DirectionUtil; import com.threerings.media.image.Mirage; import com.threerings.media.sprite.Sprite; -import com.threerings.puzzle.Log; +import static com.threerings.puzzle.Log.log; /** * The drop sprite is a sprite that displays one or more pieces falling diff --git a/src/java/com/threerings/puzzle/drop/data/DropBoard.java b/src/java/com/threerings/puzzle/drop/data/DropBoard.java index c2675c4d..afdee51e 100644 --- a/src/java/com/threerings/puzzle/drop/data/DropBoard.java +++ b/src/java/com/threerings/puzzle/drop/data/DropBoard.java @@ -29,11 +29,12 @@ import org.apache.commons.lang.StringUtils; import com.threerings.util.DirectionUtil; -import com.threerings.puzzle.Log; import com.threerings.puzzle.data.Board; import com.threerings.puzzle.drop.client.DropControllerDelegate; import com.threerings.puzzle.drop.util.DropBoardUtil; +import static com.threerings.puzzle.Log.log; + /** * A class that provides for various useful logical operations to be enacted on a two-dimensional * board and provides an easier mechanism for referencing pieces by position. @@ -132,8 +133,7 @@ public class DropBoard extends Board try { return _board[(row*_bwid) + col]; } catch (Exception e) { - Log.warning("Failed getting piece [col=" + col + ", row=" + row + ", error=" + e + "]."); - Log.logStackTrace(e); + log.warning("Failed getting piece [col=" + col + ", row=" + row + "].", e); return -1; } } @@ -319,7 +319,7 @@ public class DropBoard extends Board // this should never happen since even in the most tightly constrained case where the block // is entirely surrounded by other pieces there are always two valid orientations. - Log.warning("**** We're horked and couldn't rotate at all!"); + log.warning("**** We're horked and couldn't rotate at all!"); // System.exit(0); return null; } @@ -425,7 +425,7 @@ public class DropBoard extends Board return true; } else { - Log.warning("Attempt to set piece outside board bounds " + + log.warning("Attempt to set piece outside board bounds " + "[col=" + col + ", row=" + row + ", p=" + piece + "]."); return false; } @@ -649,7 +649,7 @@ public class DropBoard extends Board { // make sure the target board is a valid target if (board.getWidth() != _bwid || board.getHeight() != _bhei) { - Log.warning("Can't copy board into destination board with different dimensions " + + log.warning("Can't copy board into destination board with different dimensions " + "[src=" + this + ", dest=" + board + "]."); return; } @@ -686,7 +686,7 @@ public class DropBoard extends Board { int size = (_bwid*_bhei); if (board.length < size) { - Log.warning("Attempt to set board with invalid data size " + + log.warning("Attempt to set board with invalid data size " + "[len=" + board.length + ", expected=" + size + "]."); return; } diff --git a/src/java/com/threerings/puzzle/drop/server/DropManagerDelegate.java b/src/java/com/threerings/puzzle/drop/server/DropManagerDelegate.java index 17c1dd89..077f79d7 100644 --- a/src/java/com/threerings/puzzle/drop/server/DropManagerDelegate.java +++ b/src/java/com/threerings/puzzle/drop/server/DropManagerDelegate.java @@ -24,7 +24,6 @@ package com.threerings.puzzle.drop.server; import com.threerings.crowd.data.PlaceConfig; import com.threerings.crowd.data.PlaceObject; -import com.threerings.puzzle.Log; import com.threerings.puzzle.data.Board; import com.threerings.puzzle.data.PuzzleCodes; import com.threerings.puzzle.server.PuzzleManager; @@ -37,6 +36,8 @@ import com.threerings.puzzle.drop.data.DropLogic; import com.threerings.puzzle.drop.util.PieceDropLogic; import com.threerings.puzzle.drop.util.PieceDropper; +import static com.threerings.puzzle.Log.log; + /** * Provides the necessary support for a puzzle game that involves a * two-dimensional board containing pieces, with new pieces either falling @@ -81,7 +82,7 @@ public abstract class DropManagerDelegate extends PuzzleManagerDelegate _usedrop = logic.useBlockDropping(); _userise = logic.useBoardRising(); if (_usedrop && _userise) { - Log.warning("Can't use dropping blocks and board rising "+ + log.warning("Can't use dropping blocks and board rising "+ "functionality simultaneously in a drop puzzle game! " + "Falling back to straight dropping."); _userise = false; diff --git a/src/java/com/threerings/puzzle/drop/util/PieceDropper.java b/src/java/com/threerings/puzzle/drop/util/PieceDropper.java index 2e9d50ea..10478c60 100644 --- a/src/java/com/threerings/puzzle/drop/util/PieceDropper.java +++ b/src/java/com/threerings/puzzle/drop/util/PieceDropper.java @@ -27,10 +27,11 @@ import java.util.List; import com.samskivert.util.StringUtil; -import com.threerings.puzzle.Log; import com.threerings.puzzle.drop.data.DropBoard; import com.threerings.puzzle.drop.data.DropPieceCodes; +import static com.threerings.puzzle.Log.log; + /** * Handles dropping pieces in a board. */ @@ -156,7 +157,7 @@ public class PieceDropper int end = _logic.getConstrainedEdge(board, xx, yy, RIGHT); int bwid = board.getWidth(); if (start < 0 || end >= bwid) { - Log.warning("Board reported bogus constrained edge " + + log.warning("Board reported bogus constrained edge " + "[x=" + xx + ", y=" + yy + ", start=" + start + ", end=" + end + "]."); board.dump(); start = Math.max(start, 0); diff --git a/src/java/com/threerings/puzzle/server/PuzzleManager.java b/src/java/com/threerings/puzzle/server/PuzzleManager.java index ca80f506..90e60e1b 100644 --- a/src/java/com/threerings/puzzle/server/PuzzleManager.java +++ b/src/java/com/threerings/puzzle/server/PuzzleManager.java @@ -42,13 +42,14 @@ import com.threerings.parlor.game.server.GameManager; import com.threerings.util.MessageBundle; import com.threerings.util.Name; -import com.threerings.puzzle.Log; import com.threerings.puzzle.data.Board; import com.threerings.puzzle.data.BoardSummary; import com.threerings.puzzle.data.PuzzleCodes; import com.threerings.puzzle.data.PuzzleGameMarshaller; import com.threerings.puzzle.data.PuzzleObject; +import static com.threerings.puzzle.Log.log; + /** * Extends the {@link GameManager} with facilities for the puzzle games * that are used in Yohoho. Only features generic to all of our games are @@ -263,7 +264,7 @@ public abstract class PuzzleManager extends GameManager // log the AI skill levels for games involving AIs as it's useful // when tuning AI algorithms if (_AIs != null) { - Log.info("AIs on the job [game=" + _puzobj.which() + + log.info("AIs on the job [game=" + _puzobj.which() + ", skillz=" + StringUtil.toString(_AIs) + "]."); } } @@ -411,7 +412,7 @@ public abstract class PuzzleManager extends GameManager // apply the event to the player's board if (!applyProgressEvent(pidx, gevent, cboard)) { - Log.warning("Unknown event [puzzle=" + where() + + log.warning("Unknown event [puzzle=" + where() + ", pidx=" + pidx + ", event=" + gevent + "]."); } @@ -429,19 +430,19 @@ public abstract class PuzzleManager extends GameManager int gevent, boolean before) { if (DEBUG_PUZZLE) { - Log.info((before ? "About to apply " : "Just applied ") + + log.info((before ? "About to apply " : "Just applied ") + "[game=" + _puzobj.which() + ", pidx=" + pidx + ", event=" + gevent + "]."); } if (boardstate == null) { if (DEBUG_PUZZLE) { - Log.info("No board state provided. Can't compare."); + log.info("No board state provided. Can't compare."); } return; } boolean equal = _boards[pidx].equals(boardstate); if (!equal) { - Log.warning("Client and server board states not equal! " + + log.warning("Client and server board states not equal! " + "[game=" + _puzobj.which() + ", type=" + _puzobj.getClass().getName() + "]."); } @@ -524,7 +525,7 @@ public abstract class PuzzleManager extends GameManager // only warn if this isn't a straggling update from the // previous round if (roundId != _puzobj.roundId-1) { - Log.warning("Received progress update for invalid round, " + + log.warning("Received progress update for invalid round, " + "not applying [game=" + _puzobj.which() + ", invalidRoundId=" + roundId + ", roundId=" + _puzobj.roundId + "]."); @@ -534,7 +535,7 @@ public abstract class PuzzleManager extends GameManager // if the game is over, we wing straggling updates if (!_puzobj.isInPlay()) { - Log.debug("Ignoring straggling events " + + log.debug("Ignoring straggling events " + "[game=" + _puzobj.which() + ", who=" + caller.who() + ", events=" + StringUtil.toString(events) + "]."); @@ -544,7 +545,7 @@ public abstract class PuzzleManager extends GameManager // determine the caller's player index in the game int pidx = IntListUtil.indexOf(_playerOids, caller.getOid()); if (pidx == -1) { - Log.warning("Received progress update for non-player?! " + + log.warning("Received progress update for non-player?! " + "[game=" + _puzobj.which() + ", who=" + caller.who() + ", ploids=" + StringUtil.toString(_playerOids) + "]."); return; diff --git a/src/java/com/threerings/puzzle/util/PointSet.java b/src/java/com/threerings/puzzle/util/PointSet.java index 2e80614c..bf6360a8 100644 --- a/src/java/com/threerings/puzzle/util/PointSet.java +++ b/src/java/com/threerings/puzzle/util/PointSet.java @@ -24,7 +24,7 @@ package com.threerings.puzzle.util; import java.awt.Point; import java.util.Iterator; -import com.threerings.puzzle.Log; +import static com.threerings.puzzle.Log.log; /** * The point set class provides an efficient implementation of a set @@ -224,7 +224,7 @@ public class PointSet } if (_curY >= _rangeY) { - Log.warning("Advanced past point range."); + log.warning("Advanced past point range."); _curY = 0; } } diff --git a/src/java/com/threerings/stage/Log.java b/src/java/com/threerings/stage/Log.java index dfecc519..9b2b79d7 100644 --- a/src/java/com/threerings/stage/Log.java +++ b/src/java/com/threerings/stage/Log.java @@ -21,36 +21,12 @@ package com.threerings.stage; +import com.samskivert.util.Logger; + /** - * A placeholder class that contains a reference to the log object used by - * this package. + * Contains a reference to the log object used by this package. */ public class Log { - public static com.samskivert.util.Log log = - new com.samskivert.util.Log("stage"); - - /** Convenience function. */ - public static void debug (String message) - { - log.debug(message); - } - - /** Convenience function. */ - public static void info (String message) - { - log.info(message); - } - - /** Convenience function. */ - public static void warning (String message) - { - log.warning(message); - } - - /** Convenience function. */ - public static void logStackTrace (Throwable t) - { - log.logStackTrace(com.samskivert.util.Log.WARNING, t); - } + public static Logger log = Logger.getLogger("com.threerings.stage"); } diff --git a/src/java/com/threerings/stage/client/SceneColorizer.java b/src/java/com/threerings/stage/client/SceneColorizer.java index 8fba5101..80cb4d65 100644 --- a/src/java/com/threerings/stage/client/SceneColorizer.java +++ b/src/java/com/threerings/stage/client/SceneColorizer.java @@ -30,9 +30,10 @@ import com.threerings.media.tile.TileSet; import com.threerings.miso.data.ObjectInfo; -import com.threerings.stage.Log; import com.threerings.stage.data.StageScene; +import static com.threerings.stage.Log.log; + /** * Handles colorization of object tiles in a scene. */ @@ -123,7 +124,7 @@ public class SceneColorizer implements TileSet.Colorizer // 3. If there are no defaults whatsoever, just hash on the sceneId. int[] cids = (int[])_cids.get(zation); if (cids == null) { - Log.warning("Zoiks, have no colorizations for '" + + log.warning("Zoiks, have no colorizations for '" + zation + "'."); return -1; } else { diff --git a/src/java/com/threerings/stage/client/StageSceneController.java b/src/java/com/threerings/stage/client/StageSceneController.java index c7089dfa..4ac99cf3 100644 --- a/src/java/com/threerings/stage/client/StageSceneController.java +++ b/src/java/com/threerings/stage/client/StageSceneController.java @@ -29,10 +29,11 @@ import com.threerings.crowd.util.CrowdContext; import com.threerings.whirled.data.SceneUpdate; import com.threerings.whirled.spot.client.SpotSceneController; -import com.threerings.stage.Log; import com.threerings.stage.data.StageLocation; import com.threerings.stage.util.StageContext; +import static com.threerings.stage.Log.log; + /** * Extends the {@link SpotSceneController} with functionality specific to * displaying Stage scenes. @@ -44,7 +45,7 @@ public class StageSceneController extends SpotSceneController */ public void handleLocationClicked (Object source, StageLocation loc) { - Log.warning("handleLocationClicked(" + source + ", " + loc + ")"); + log.warning("handleLocationClicked(" + source + ", " + loc + ")"); } /** @@ -55,7 +56,7 @@ public class StageSceneController extends SpotSceneController */ public void handleClusterClicked (Object source, Tuple tuple) { - Log.warning("handleClusterClicked(" + source + ", " + tuple + ")"); + log.warning("handleClusterClicked(" + source + ", " + tuple + ")"); } // documentation inherited diff --git a/src/java/com/threerings/stage/client/StageScenePanel.java b/src/java/com/threerings/stage/client/StageScenePanel.java index dd6b42ab..d62a5e92 100644 --- a/src/java/com/threerings/stage/client/StageScenePanel.java +++ b/src/java/com/threerings/stage/client/StageScenePanel.java @@ -70,7 +70,6 @@ import com.threerings.whirled.spot.data.Location; import com.threerings.whirled.spot.data.Portal; import com.threerings.whirled.spot.data.SceneLocation; -import com.threerings.stage.Log; import com.threerings.stage.data.StageLocation; import com.threerings.stage.data.StageMisoSceneModel; import com.threerings.stage.data.StageScene; @@ -78,6 +77,8 @@ import com.threerings.stage.data.StageSceneModel; import com.threerings.stage.util.StageContext; import com.threerings.stage.util.StageSceneUtil; +import static com.threerings.stage.Log.log; + /** * Extends the basic Miso scene panel with Stage fun stuff like portals, * clusters and locations. @@ -149,7 +150,7 @@ public class StageScenePanel extends MisoScenePanel setSceneModel(StageMisoSceneModel.getSceneModel( scene.getSceneModel())); } else { - Log.warning("Zoiks! We can't display a null scene!"); + log.warning("Zoiks! We can't display a null scene!"); // TODO: display something to the user letting them know that // we're so hosed that we don't even know what time it is } diff --git a/src/java/com/threerings/stage/data/StageScene.java b/src/java/com/threerings/stage/data/StageScene.java index 4b7e2ee7..3e74baaf 100644 --- a/src/java/com/threerings/stage/data/StageScene.java +++ b/src/java/com/threerings/stage/data/StageScene.java @@ -38,7 +38,7 @@ import com.threerings.whirled.spot.data.SpotScene; import com.threerings.whirled.spot.data.SpotSceneImpl; import com.threerings.whirled.spot.data.SpotSceneModel; -import com.threerings.stage.Log; +import static com.threerings.stage.Log.log; /** * The implementation of the Stage scene interface. @@ -119,7 +119,7 @@ public class StageScene extends SceneImpl StageMisoSceneModel mmodel = StageMisoSceneModel.getSceneModel(_model); if (mmodel != null) { if (!mmodel.addObject(info)) { - Log.warning("Scene model rejected object add " + + log.warning("Scene model rejected object add " + "[scene=" + this + ", object=" + info + "]."); } } diff --git a/src/java/com/threerings/stage/server/StageSceneManager.java b/src/java/com/threerings/stage/server/StageSceneManager.java index 71c4868a..b30f499e 100644 --- a/src/java/com/threerings/stage/server/StageSceneManager.java +++ b/src/java/com/threerings/stage/server/StageSceneManager.java @@ -47,7 +47,6 @@ import com.threerings.whirled.spot.data.Portal; import com.threerings.whirled.spot.data.SceneLocation; import com.threerings.whirled.spot.server.SpotSceneManager; -import com.threerings.stage.Log; import com.threerings.stage.client.StageSceneService; import com.threerings.stage.data.DefaultColorUpdate; import com.threerings.stage.data.ModifyObjectsUpdate; @@ -61,6 +60,8 @@ import com.threerings.stage.data.StageSceneModel; import com.threerings.stage.data.StageSceneObject; import com.threerings.stage.util.StageSceneUtil; +import static com.threerings.stage.Log.log; + /** * Defines extensions to the basic Stage scene manager specific to * displaying isometric "stage" scenes (these may be indoor, outdoor or @@ -111,7 +112,7 @@ public class StageSceneManager extends SpotSceneManager Rectangle foot = StageSceneUtil.getObjectFootprint( StageServer.tilemgr, info.tileId, info.x, info.y); if (foot == null) { - Log.warning("Aiya! Unable to compute object footprint! " + + log.warning("Aiya! Unable to compute object footprint! " + "[where=" + where() + ", info=" + info + "]."); return false; } @@ -130,7 +131,7 @@ public class StageSceneManager extends SpotSceneManager update.init(_sscene.getId(), _sscene.getVersion(), new ObjectInfo[] { info }, killOverlap ? lappers : null); - Log.info("Modifying objects '" + update + "."); + log.info("Modifying objects '" + update + "."); recordUpdate(update, true); return true; @@ -197,7 +198,7 @@ public class StageSceneManager extends SpotSceneManager ModifyObjectsUpdate update = new ModifyObjectsUpdate(); update.init(_sscene.getId(), _sscene.getVersion(), null, info); - Log.info("Modifying objects '" + update + "."); + log.info("Modifying objects '" + update + "."); recordUpdate(update, true); listener.requestProcessed(); @@ -393,7 +394,7 @@ public class StageSceneManager extends SpotSceneManager { // sanity check if (entry == null) { - Log.warning("Requested to compute entering location for " + + log.warning("Requested to compute entering location for " + "non-existent portal [where=" + where() + ", who=" + body.who() + "]."); entry = _sscene.getDefaultEntrance(); @@ -553,7 +554,7 @@ public class StageSceneManager extends SpotSceneManager // make sure this person isn't already in our cluster ClusterObject clobj = clrec.getClusterObject(); if (clobj != null && clobj.occupants.contains(bodyOid)) { - Log.warning("Ignoring stale occupant [where=" + where() + + log.warning("Ignoring stale occupant [where=" + where() + ", cluster=" + cl + ", occ=" + bodyOid + "]."); continue; } @@ -561,7 +562,7 @@ public class StageSceneManager extends SpotSceneManager // make sure the subsumee exists final BodyObject bobj = (BodyObject)StageServer.omgr.getObject(bodyOid); if (bobj == null) { - Log.warning("Can't subsume disappeared body " + + log.warning("Can't subsume disappeared body " + "[where=" + where() + ", cluster=" + cl + ", boid=" + bodyOid + "]."); continue; @@ -574,12 +575,12 @@ public class StageSceneManager extends SpotSceneManager StageServer.omgr.postRunnable(new Runnable() { public void run () { try { - Log.info("Subsuming " + bobj.who() + + log.info("Subsuming " + bobj.who() + " into " + fclrec.getCluster() + "."); fclrec.addBody(bobj); } catch (InvocationException ie) { - Log.info("Unable to subsume neighbor " + + log.info("Unable to subsume neighbor " + "[cluster=" + fclrec.getCluster() + ", neighbor=" + bobj.who() + ", cause=" + ie.getMessage() + "]."); @@ -672,7 +673,7 @@ public class StageSceneManager extends SpotSceneManager cl.width = 1; cl.height = 1; SceneLocation loc = locationForBody(bodyOid); if (loc == null) { - Log.warning("Foreign body added to cluster [clrec=" + clrec + + log.warning("Foreign body added to cluster [clrec=" + clrec + ", body=" + body.who() + "]."); cl.x = 10; cl.y = 10; } else { @@ -710,7 +711,7 @@ public class StageSceneManager extends SpotSceneManager if (sloc == null) { BodyObject user = (BodyObject)StageServer.omgr.getObject(bodyOid); String who = (user == null) ? ("" + bodyOid) : user.who(); - Log.warning("Can't position locationless user " + + log.warning("Can't position locationless user " + "[where=" + where() + ", cluster=" + cl + ", boid=" + who + "]."); return; @@ -772,7 +773,7 @@ public class StageSceneManager extends SpotSceneManager StageOccupantInfo info = (StageOccupantInfo)_ssobj.occupantInfo.get( Integer.valueOf(target.getOid())); if (info == null) { - Log.warning("Have no occinfo for cluster target " + + log.warning("Have no occinfo for cluster target " + "[where=" + where() + ", init=" + initiator.who() + ", target=" + target.who() + "]."); throw new InvocationException(INTERNAL_ERROR); diff --git a/src/java/com/threerings/stage/server/StageServer.java b/src/java/com/threerings/stage/server/StageServer.java index b975cb37..27e94a84 100644 --- a/src/java/com/threerings/stage/server/StageServer.java +++ b/src/java/com/threerings/stage/server/StageServer.java @@ -28,9 +28,10 @@ import com.threerings.media.tile.bundle.BundledTileSetRepository; import com.threerings.whirled.server.WhirledServer; -import com.threerings.stage.Log; import com.threerings.stage.data.StageCodes; +import static com.threerings.stage.Log.log; + /** * Extends the Whirled server to provide services needed by the Stage * system. @@ -62,7 +63,7 @@ public abstract class StageServer extends WhirledServer new BundledTileSetRepository(rsrcmgr, null, StageCodes.TILESET_RSRC_SET)); - Log.info("Stage server initialized."); + log.info("Stage server initialized."); } /** diff --git a/src/java/com/threerings/stage/tools/editor/EditorApp.java b/src/java/com/threerings/stage/tools/editor/EditorApp.java index de135ca8..0f703513 100644 --- a/src/java/com/threerings/stage/tools/editor/EditorApp.java +++ b/src/java/com/threerings/stage/tools/editor/EditorApp.java @@ -69,6 +69,8 @@ import com.threerings.stage.data.StageSceneModel; import com.threerings.stage.tools.editor.util.EditorContext; import com.threerings.stage.tools.xml.StageSceneWriter; +import static com.threerings.stage.Log.log; + /** * A scene editor application that provides facilities for viewing, * editing, and saving the scene templates that comprise a game. @@ -84,7 +86,7 @@ public class EditorApp implements Runnable final String target = (args.length > 0) ? args[0] : null; if (System.getProperty("no_log_redir") != null) { - Log.info("Logging to console only."); + log.info("Logging to console only."); } else { String dlog = localDataDir("editor.log"); @@ -93,10 +95,10 @@ public class EditorApp implements Runnable new BufferedOutputStream(new FileOutputStream(dlog)), true); System.setOut(logOut); System.setErr(logOut); - Log.info("Opened debug log '" + dlog + "'."); + log.info("Opened debug log '" + dlog + "'."); } catch (IOException ioe) { - Log.warning("Failed to open debug log [path=" + dlog + + log.warning("Failed to open debug log [path=" + dlog + ", error=" + ioe + "]."); } } @@ -145,8 +147,7 @@ public class EditorApp implements Runnable } public void initializationFailed (Exception e) { - Log.warning("Failed unpacking bundles [e=" + e + "]."); - Log.logStackTrace(e); + log.warning("Failed unpacking bundles [e=" + e + "].", e); } }; // we want our methods called on the AWT thread @@ -166,7 +167,7 @@ public class EditorApp implements Runnable _crepo = new BundledComponentRepository( _rmgr, _imgr, "components"); } catch (IOException e) { - Log.warning("Exception loading tilesets and and icon manager " + + log.warning("Exception loading tilesets and and icon manager " + "[Exception=" + e + "]."); return; } @@ -224,13 +225,12 @@ public class EditorApp implements Runnable } catch (Throwable t) { // Win98 seems to choke on it's own vomit when we attempt to // enumerate the available display modes; yay! - Log.warning("Failed to probe display mode."); - Log.logStackTrace(t); + log.warning("Failed to probe display mode.", t); } if (_viewFullScreen.getValue() && gd.isFullScreenSupported() && pmode != null) { - Log.info("Switching to screen mode " + + log.info("Switching to screen mode " + "[mode=" + ModeUtil.toString(pmode) + "]."); // set the frame to undecorated, full-screen _frame.setUndecorated(true); @@ -277,8 +277,7 @@ public class EditorApp implements Runnable EventQueue.invokeLater(app); } catch (IOException ioe) { - Log.warning("Unable to initialize editor."); - Log.logStackTrace(ioe); + log.warning("Unable to initialize editor.", ioe); } } @@ -328,7 +327,7 @@ public class EditorApp implements Runnable public String xlate (String bundle, String message) { MessageBundle mbundle = _msgmgr.getBundle(bundle); if (mbundle == null) { - Log.warning("Requested to translate message with " + + log.warning("Requested to translate message with " + "non-existent bundle [bundle=" + bundle + ", message=" + message + "]."); return message; diff --git a/src/java/com/threerings/stage/tools/editor/EditorFrame.java b/src/java/com/threerings/stage/tools/editor/EditorFrame.java index bdd80225..08a5d8ad 100644 --- a/src/java/com/threerings/stage/tools/editor/EditorFrame.java +++ b/src/java/com/threerings/stage/tools/editor/EditorFrame.java @@ -52,6 +52,7 @@ import com.samskivert.swing.util.SwingUtil; import com.threerings.media.ManagedJFrame; import com.threerings.miso.tile.BaseTileSet; import com.threerings.miso.util.MisoSceneMetrics; + import com.threerings.stage.data.StageScene; import com.threerings.stage.data.StageSceneModel; import com.threerings.stage.tools.editor.util.EditorContext; @@ -60,6 +61,8 @@ import com.threerings.stage.tools.xml.StageSceneParser; import com.threerings.stage.tools.xml.StageSceneWriter; import com.threerings.whirled.tools.xml.SceneParser; +import static com.threerings.stage.Log.log; + public class EditorFrame extends ManagedJFrame { public EditorFrame (StageSceneWriter writer) @@ -171,8 +174,7 @@ public class EditorFrame extends ManagedJFrame try { loaded = loadScene(lastFile); } catch (Exception e) { - Log.warning("Unable to load last scene, creating new one [file=" + lastFile + "]"); - Log.logStackTrace(e); + log.warning("Unable to load last scene, creating new one", "file", lastFile, e); } } if (!loaded) { @@ -290,8 +292,7 @@ public class EditorFrame extends ManagedJFrame setScene(new StageScene(model, null)); } catch (Exception e) { - Log.warning("Unable to set blank scene."); - Log.logStackTrace(e); + log.warning("Unable to set blank scene.", e); } } @@ -337,7 +338,7 @@ public class EditorFrame extends ManagedJFrame } catch (Exception e) { errmsg = "Parse error: " + e; - Log.logStackTrace(e); + log.warning(e); } if (errmsg != null) { @@ -387,14 +388,14 @@ public class EditorFrame extends ManagedJFrame // the old file File sfile = new File(_filepath); if (!sfile.delete()) { - Log.warning("Aiya! Not able to remove " + _filepath + + log.warning("Aiya! Not able to remove " + _filepath + " so that we can replace it with " + tmpfile.getPath() + "."); } // now rename the new save file into place if (!tmpfile.renameTo(sfile)) { - Log.warning("Fork! Not able to rename " + tmpfile.getPath() + + log.warning("Fork! Not able to rename " + tmpfile.getPath() + " to " + _filepath + "."); } @@ -402,9 +403,7 @@ public class EditorFrame extends ManagedJFrame String errmsg = "Unable to save scene to " + _filepath + ":\n" + e; JOptionPane.showMessageDialog( this, errmsg, "Save error", JOptionPane.ERROR_MESSAGE); - Log.warning("Error writing scene " + - "[fname=" + _filepath + ", e=" + e + "]."); - Log.logStackTrace(e); + log.warning("Error writing scene [fname=" + _filepath + "].", e); } } @@ -514,7 +513,7 @@ public class EditorFrame extends ManagedJFrame if (_model.getTileSet() instanceof BaseTileSet) { _svpanel.updateDefaultTileSet(_model.getTileSetId()); } else { - Log.warning("Not making non-base tileset into default " + + log.warning("Not making non-base tileset into default " + _model.getTileSet() + "."); } } @@ -545,7 +544,7 @@ public class EditorFrame extends ManagedJFrame break; default: - Log.warning("Wha? Weird dialog type " + _chooser.getDialogType() + "."); + log.warning("Wha? Weird dialog type " + _chooser.getDialogType() + "."); break; } } diff --git a/src/java/com/threerings/stage/tools/editor/EditorModel.java b/src/java/com/threerings/stage/tools/editor/EditorModel.java index 06c2c05f..57f2bb7d 100644 --- a/src/java/com/threerings/stage/tools/editor/EditorModel.java +++ b/src/java/com/threerings/stage/tools/editor/EditorModel.java @@ -30,6 +30,8 @@ import com.threerings.media.tile.TileUtil; import com.threerings.util.DirectionCodes; +import static com.threerings.stage.Log.log; + /** * The EditorModel class provides a holding place for storing, * modifying and retrieving data that is shared across the Editor @@ -183,7 +185,7 @@ public class EditorModel } } - Log.warning("Attempt to set to unknown mode [cmd=" + cmd + "]."); + log.warning("Attempt to set to unknown mode [cmd=" + cmd + "]."); } /** diff --git a/src/java/com/threerings/stage/tools/editor/EditorScenePanel.java b/src/java/com/threerings/stage/tools/editor/EditorScenePanel.java index 7b16287c..2a6e4d73 100644 --- a/src/java/com/threerings/stage/tools/editor/EditorScenePanel.java +++ b/src/java/com/threerings/stage/tools/editor/EditorScenePanel.java @@ -75,6 +75,8 @@ import com.threerings.stage.tools.editor.util.EditorContext; import com.threerings.stage.tools.editor.util.EditorDialogUtil; import com.threerings.stage.tools.editor.util.ExtrasPainter; +import static com.threerings.stage.Log.log; + /** * Displays the scene view and handles UI events on the scene. Various * actions may be performed on the scene depending on the selected action @@ -204,7 +206,7 @@ public class EditorScenePanel extends StageScenePanel _vertRange.setRangeProperties( vval, _vbounds.height, _area.y, vmax, false); -// Log.info("Updated extents area:" + StringUtil.toString(_area) + +// log.info("Updated extents area:" + StringUtil.toString(_area) + // " vb:" + StringUtil.toString(_vbounds) + "."); // update the dimensions of the scrollbox @@ -251,7 +253,7 @@ public class EditorScenePanel extends StageScenePanel protected void deleteTile (int x, int y) { Rectangle drag = clearTileSelectRegion(x, y); - Log.info("Deleting " + drag); + log.info("Deleting " + drag); switch (_emodel.getLayerIndex()) { case EditorModel.BASE_LAYER: @@ -658,7 +660,7 @@ public class EditorScenePanel extends StageScenePanel } return true; } - Log.warning("Requested to remove unknown object " + scobj + "."); + log.warning("Requested to remove unknown object " + scobj + "."); return false; } diff --git a/src/java/com/threerings/stage/tools/editor/EditorToolBarPanel.java b/src/java/com/threerings/stage/tools/editor/EditorToolBarPanel.java index 5ba79549..089b764b 100644 --- a/src/java/com/threerings/stage/tools/editor/EditorToolBarPanel.java +++ b/src/java/com/threerings/stage/tools/editor/EditorToolBarPanel.java @@ -32,6 +32,8 @@ import com.threerings.media.tile.TileIcon; import com.threerings.media.tile.TileManager; import com.threerings.media.tile.UniformTileSet; +import static com.threerings.stage.Log.log; + public class EditorToolBarPanel extends JPanel implements ActionListener { public EditorToolBarPanel (TileManager tilemgr, EditorModel model) @@ -63,7 +65,7 @@ public class EditorToolBarPanel extends JPanel implements ActionListener _buttons.add(b); } else { - Log.warning("Unable to load toolbar icon " + + log.warning("Unable to load toolbar icon " + "[index=" + ii + "]."); } } @@ -113,7 +115,7 @@ public class EditorToolBarPanel extends JPanel implements ActionListener _model.setActionMode(cmd.substring(5)); } else { - Log.warning("Unknown action command [cmd=" + cmd + "]."); + log.warning("Unknown action command [cmd=" + cmd + "]."); } } diff --git a/src/java/com/threerings/stage/tools/editor/Log.java b/src/java/com/threerings/stage/tools/editor/Log.java deleted file mode 100644 index e449a84d..00000000 --- a/src/java/com/threerings/stage/tools/editor/Log.java +++ /dev/null @@ -1,56 +0,0 @@ -// -// $Id$ -// -// Vilya library - tools for developing networked games -// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved -// http://www.threerings.net/code/vilya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.stage.tools.editor; - -/** - * A placeholder class that contains a reference to the log object used by - * this package. - */ -public class Log -{ - public static com.samskivert.util.Log log = - new com.samskivert.util.Log("stage.tools.editor"); - - /** Convenience function. */ - public static void debug (String message) - { - log.debug(message); - } - - /** Convenience function. */ - public static void info (String message) - { - log.info(message); - } - - /** Convenience function. */ - public static void warning (String message) - { - log.warning(message); - } - - /** Convenience function. */ - public static void logStackTrace (Throwable t) - { - log.logStackTrace(com.samskivert.util.Log.WARNING, t); - } -} diff --git a/src/java/com/threerings/stage/tools/editor/PreferencesDialog.java b/src/java/com/threerings/stage/tools/editor/PreferencesDialog.java index 0a4ab122..c3348a64 100644 --- a/src/java/com/threerings/stage/tools/editor/PreferencesDialog.java +++ b/src/java/com/threerings/stage/tools/editor/PreferencesDialog.java @@ -38,6 +38,8 @@ import com.samskivert.swing.VGroupLayout; import com.threerings.stage.tools.editor.util.EditorDialogUtil; +import static com.threerings.stage.Log.log; + /** * A dialog for editing preferences. */ @@ -87,7 +89,7 @@ public class PreferencesDialog extends JInternalFrame EditorDialogUtil.dispose(this); } else { - Log.warning("Unknown action command [cmd=" + cmd + "]."); + log.warning("Unknown action command [cmd=" + cmd + "]."); } } diff --git a/src/java/com/threerings/stage/tools/editor/TestTileLoader.java b/src/java/com/threerings/stage/tools/editor/TestTileLoader.java index ce77e2aa..d0e4afb2 100644 --- a/src/java/com/threerings/stage/tools/editor/TestTileLoader.java +++ b/src/java/com/threerings/stage/tools/editor/TestTileLoader.java @@ -42,6 +42,8 @@ import com.threerings.media.tile.tools.xml.ObjectTileSetRuleSet; import com.threerings.media.tile.tools.xml.SwissArmyTileSetRuleSet; import com.threerings.media.tile.tools.xml.XMLTileSetParser; +import static com.threerings.stage.Log.log; + /** * The TestTileLoader handles test tiles. Test tiles are tiles that an * artist can load in on-the-fly to see how things look in the scene editor. @@ -83,7 +85,7 @@ public class TestTileLoader implements TileSetIDBroker File testdir = new File(directory); // make sure it's a directory if (!testdir.isDirectory()) { - Log.warning("Test tileset directory is not actually a directory: " + + log.warning("Test tileset directory is not actually a directory: " + directory); return map; } @@ -124,8 +126,7 @@ public class TestTileLoader implements TileSetIDBroker try { _parser.loadTileSets(xmlfile, tiles); } catch (IOException ioe) { - Log.warning("Error while parsing " + xmlfile.getPath()); - Log.logStackTrace(ioe); + log.warning("Error while parsing " + xmlfile.getPath(), ioe); continue; } diff --git a/src/java/com/threerings/stage/tools/editor/TileInfoPanel.java b/src/java/com/threerings/stage/tools/editor/TileInfoPanel.java index cd62d11d..f542c0cf 100644 --- a/src/java/com/threerings/stage/tools/editor/TileInfoPanel.java +++ b/src/java/com/threerings/stage/tools/editor/TileInfoPanel.java @@ -67,6 +67,8 @@ import com.threerings.media.tile.TileSetRepository; import com.threerings.stage.tools.editor.util.EditorContext; import com.threerings.stage.tools.editor.util.TileSetUtil; +import static com.threerings.stage.Log.log; + /** * The tile info panel presents the user with options to select the * tile to be applied to the scene. @@ -114,8 +116,7 @@ public class TileInfoPanel extends JSplitPane } } catch (Exception e) { - Log.warning("Error enumerating tilesets."); - Log.logStackTrace(e); + log.warning("Error enumerating tilesets.", e); } // set up a border denoting our contents @@ -271,7 +272,7 @@ public class TileInfoPanel extends JSplitPane Object uobj = node.getUserObject(); if (!(uobj instanceof TileSetRecord)) { - Log.info("Eh? Non-TileSetRecord leaf [obj=" + uobj + + log.info("Eh? Non-TileSetRecord leaf [obj=" + uobj + ", class=" + StringUtil.shortClassName(uobj) + "]."); return; } diff --git a/src/java/com/threerings/stage/tools/editor/util/TileSetUtil.java b/src/java/com/threerings/stage/tools/editor/util/TileSetUtil.java index 621a021b..55bf1368 100644 --- a/src/java/com/threerings/stage/tools/editor/util/TileSetUtil.java +++ b/src/java/com/threerings/stage/tools/editor/util/TileSetUtil.java @@ -24,7 +24,6 @@ package com.threerings.stage.tools.editor.util; import com.threerings.media.tile.TileSet; import com.threerings.miso.tile.BaseTileSet; -import com.threerings.stage.tools.editor.Log; import com.threerings.stage.tools.editor.EditorModel; /** diff --git a/src/java/com/threerings/stage/tools/viewer/ViewerApp.java b/src/java/com/threerings/stage/tools/viewer/ViewerApp.java index 6fe901f7..5a9bf3e1 100644 --- a/src/java/com/threerings/stage/tools/viewer/ViewerApp.java +++ b/src/java/com/threerings/stage/tools/viewer/ViewerApp.java @@ -50,9 +50,10 @@ import com.threerings.cast.ComponentRepository; import com.threerings.miso.tile.MisoTileManager; -import com.threerings.stage.Log; import com.threerings.stage.util.StageContext; +import static com.threerings.stage.Log.log; + /** * The ViewerApp is a scene viewing application that allows for trying out * Stage scenes in a pseudo-runtime environment. @@ -71,7 +72,7 @@ public class ViewerApp // get the target graphics device GraphicsDevice gd = env.getDefaultScreenDevice(); - Log.info("Graphics device [dev=" + gd + + log.info("Graphics device [dev=" + gd + ", mem=" + gd.getAvailableAcceleratedMemory() + ", displayChange=" + gd.isDisplayChangeSupported() + ", fullScreen=" + gd.isFullScreenSupported() + "]."); @@ -79,7 +80,7 @@ public class ViewerApp // get the graphics configuration and display mode information GraphicsConfiguration gc = gd.getDefaultConfiguration(); DisplayMode dm = gd.getDisplayMode(); - Log.info("Display mode [bits=" + dm.getBitDepth() + + log.info("Display mode [bits=" + dm.getBitDepth() + ", wid=" + dm.getWidth() + ", hei=" + dm.getHeight() + ", refresh=" + dm.getRefreshRate() + "]."); @@ -105,7 +106,7 @@ public class ViewerApp // size and position the window, entering full-screen exclusive // mode if available and desired if (gd.isFullScreenSupported() /* && _viewFullScreen.getValue() */) { - Log.info("Entering full-screen exclusive mode."); + log.info("Entering full-screen exclusive mode."); gd.setFullScreenWindow(_frame); } else { _frame.setSize(640, 575); diff --git a/src/java/com/threerings/stage/tools/viewer/ViewerFrame.java b/src/java/com/threerings/stage/tools/viewer/ViewerFrame.java index 327429e8..3fb5f653 100644 --- a/src/java/com/threerings/stage/tools/viewer/ViewerFrame.java +++ b/src/java/com/threerings/stage/tools/viewer/ViewerFrame.java @@ -46,12 +46,13 @@ import com.threerings.whirled.spot.data.Location; import com.threerings.whirled.spot.data.Portal; import com.threerings.whirled.spot.data.SpotSceneModel; -import com.threerings.stage.Log; import com.threerings.stage.data.StageScene; import com.threerings.stage.data.StageSceneModel; import com.threerings.stage.tools.xml.StageSceneParser; import com.threerings.stage.util.StageContext; +import static com.threerings.stage.Log.log; + /** * The viewer frame is the main application window. */ @@ -167,7 +168,7 @@ public class ViewerFrame extends ManagedJFrame } } if (defloc == null) { - Log.warning("Scene has no def. entrance '" + path + "'."); + log.warning("Scene has no def. entrance '" + path + "'."); } _panel.setScene(new StageScene(model, null), defloc); @@ -175,7 +176,7 @@ public class ViewerFrame extends ManagedJFrame } catch (Exception e) { errmsg = "Error parsing scene file '" + path + "'."; - Log.logStackTrace(e); + log.warning(e); } if (errmsg != null) { diff --git a/src/java/com/threerings/stage/tools/viewer/ViewerScenePanel.java b/src/java/com/threerings/stage/tools/viewer/ViewerScenePanel.java index 56fe65de..79db8adf 100644 --- a/src/java/com/threerings/stage/tools/viewer/ViewerScenePanel.java +++ b/src/java/com/threerings/stage/tools/viewer/ViewerScenePanel.java @@ -48,11 +48,12 @@ import com.threerings.media.util.Path; import com.threerings.stage.client.StageScenePanel; import com.threerings.whirled.spot.data.Location; -import com.threerings.stage.Log; import com.threerings.stage.data.StageLocation; import com.threerings.stage.data.StageScene; import com.threerings.stage.util.StageContext; +import static com.threerings.stage.Log.log; + public class ViewerScenePanel extends StageScenePanel implements PerformanceObserver, PathObserver { @@ -165,7 +166,7 @@ public class ViewerScenePanel extends StageScenePanel // documentation inherited public void checkpoint (String name, int ticks) { - Log.info(name + " [ticks=" + ticks + "]."); + log.info(name + " [ticks=" + ticks + "]."); } /** MouseListener interface methods */ diff --git a/src/java/com/threerings/stage/util/PlacementConstraints.java b/src/java/com/threerings/stage/util/PlacementConstraints.java index f0b9cabf..be3211fc 100644 --- a/src/java/com/threerings/stage/util/PlacementConstraints.java +++ b/src/java/com/threerings/stage/util/PlacementConstraints.java @@ -40,11 +40,12 @@ import com.threerings.media.tile.TileManager; import com.threerings.miso.data.ObjectInfo; -import com.threerings.stage.Log; import com.threerings.stage.data.StageCodes; import com.threerings.stage.data.StageMisoSceneModel; import com.threerings.stage.data.StageScene; +import static com.threerings.stage.Log.log; + /** * Maintains extra information on objects in a scene and checks proposed * placement operations for constraint violations. When the constraints @@ -169,7 +170,7 @@ public class PlacementConstraints for (int ii = 0; ii < info.length; ii++) { data[ii] = _objectData.get(info[ii]); if (data[ii] == null) { - Log.warning("Couldn't match object info up to data [info=" + + log.warning("Couldn't match object info up to data [info=" + info[ii] + "]."); return null; } @@ -532,9 +533,7 @@ public class PlacementConstraints return new ObjectData(bounds, tile); } catch (Exception e) { - Log.warning("Error retrieving tile for object [info=" + - info + ", error=" + e + "]."); - Log.logStackTrace(e); + log.warning("Error retrieving tile for object [info=" + info + "].", e); return null; } } diff --git a/src/java/com/threerings/stage/util/StageSceneUtil.java b/src/java/com/threerings/stage/util/StageSceneUtil.java index 55380e70..62b25565 100644 --- a/src/java/com/threerings/stage/util/StageSceneUtil.java +++ b/src/java/com/threerings/stage/util/StageSceneUtil.java @@ -46,11 +46,12 @@ import com.threerings.miso.util.ObjectSet; import com.threerings.whirled.spot.data.Cluster; import com.threerings.whirled.spot.data.SceneLocation; -import com.threerings.stage.Log; import com.threerings.stage.data.StageLocation; import com.threerings.stage.data.StageMisoSceneModel; import com.threerings.stage.data.StageSceneModel; +import static com.threerings.stage.Log.log; + /** * Provides scene related utility functions. */ @@ -144,7 +145,7 @@ public class StageSceneUtil return new StageLocation(opos.x, opos.y, (byte)orient); } catch (Exception e) { - Log.warning("Unable to look up object tile for scene object " + + log.warning("Unable to look up object tile for scene object " + "[tileId=" + tileId + ", error=" + e + "]."); } return null; @@ -208,7 +209,7 @@ public class StageSceneUtil return true; } catch (Exception e) { - Log.warning("Unable to look up object tile for scene object " + + log.warning("Unable to look up object tile for scene object " + "[tileId=" + tileId + ", error=" + e + "]."); return false; } @@ -232,7 +233,7 @@ public class StageSceneUtil return tset.getPassability()[tidx]; } catch (Exception e) { - Log.warning("Unable to look up base tile [tileId=" + tileId + + log.warning("Unable to look up base tile [tileId=" + tileId + ", error=" + e + "]."); return true; } @@ -266,7 +267,7 @@ public class StageSceneUtil double radius = (double)fwid/2; int clidx = cluster.width-2; if (clidx >= CLUSTER_METRICS.length/2 || clidx < 0) { - Log.warning("Requested locs from invalid cluster " + cluster + "."); + log.warning("Requested locs from invalid cluster " + cluster + "."); Thread.dumpStack(); return list; } @@ -434,7 +435,7 @@ public class StageSceneUtil objs.remove(ii--); } } else { - Log.warning("Unknown potentially intersecting object?! " + + log.warning("Unknown potentially intersecting object?! " + "[scene=" + model.name + " (" + model.sceneId + "), info=" + info + "]."); } diff --git a/src/java/com/threerings/stats/Log.java b/src/java/com/threerings/stats/Log.java index ffb87e23..779d2fd8 100644 --- a/src/java/com/threerings/stats/Log.java +++ b/src/java/com/threerings/stats/Log.java @@ -3,7 +3,7 @@ package com.threerings.stats; -import java.util.logging.Logger; +import com.samskivert.util.Logger; /** * A placeholder class that contains a reference to the log object used by this project. diff --git a/src/java/com/threerings/stats/server/persist/StatRepository.java b/src/java/com/threerings/stats/server/persist/StatRepository.java index 576379d8..3d97fb09 100644 --- a/src/java/com/threerings/stats/server/persist/StatRepository.java +++ b/src/java/com/threerings/stats/server/persist/StatRepository.java @@ -103,7 +103,7 @@ public class StatRepository extends DepotRepository updateStat(playerId, stats[ii]); } } catch (Exception e) { - log.log(Level.WARNING, "Error flushing modified stat [stat=" + stats[ii] + "].", e); + log.warning("Error flushing modified stat [stat=" + stats[ii] + "].", e); } } } @@ -120,7 +120,7 @@ public class StatRepository extends DepotRepository try { code = assignStringCode(type, value); } catch (PersistenceException pe) { - log.log(Level.WARNING, "Failed to assign code [type=" + type + + log.warning("Failed to assign code [type=" + type + ", value=" + value + "].", pe); // at this point the database is probably totally hosed, so we can just punt here, // and assume that this value will never be persisted @@ -142,7 +142,7 @@ public class StatRepository extends DepotRepository try { loadStringCodes(type); } catch (PersistenceException pe) { - log.log(Level.WARNING, "Failed to reload string codes " + + log.warning("Failed to reload string codes " + "[type=" + type + ", code=" + code + "].", pe); } map = _codeToString.get(type); @@ -200,7 +200,7 @@ public class StatRepository extends DepotRepository errmsg = "Unable to decode stat"; } - log.log(Level.WARNING, errmsg + " [type=" + stat.getType() + "]", error); + log.warning(errmsg + " [type=" + stat.getType() + "]", error); return null; } diff --git a/src/java/com/threerings/whirled/Log.java b/src/java/com/threerings/whirled/Log.java index f800b329..a2b8b630 100644 --- a/src/java/com/threerings/whirled/Log.java +++ b/src/java/com/threerings/whirled/Log.java @@ -21,43 +21,12 @@ package com.threerings.whirled; +import com.samskivert.util.Logger; + /** - * A placeholder class that contains a reference to the log object used by - * the Whirled services. + * Contains a reference to the log object used by the Whirled services. */ public class Log { - public static com.samskivert.util.Log log = - new com.samskivert.util.Log("whirled"); - - /** Convenience function. */ - public static boolean debug () - { - return (com.samskivert.util.Log.getLevel() == - com.samskivert.util.Log.DEBUG); - } - - /** Convenience function. */ - public static void debug (String message) - { - log.debug(message); - } - - /** Convenience function. */ - public static void info (String message) - { - log.info(message); - } - - /** Convenience function. */ - public static void warning (String message) - { - log.warning(message); - } - - /** Convenience function. */ - public static void logStackTrace (Throwable t) - { - log.logStackTrace(com.samskivert.util.Log.WARNING, t); - } + public static Logger log = Logger.getLogger("com.threerings.whirled"); } diff --git a/src/java/com/threerings/whirled/client/SceneDirector.java b/src/java/com/threerings/whirled/client/SceneDirector.java index c8f71a0e..ebb9476a 100644 --- a/src/java/com/threerings/whirled/client/SceneDirector.java +++ b/src/java/com/threerings/whirled/client/SceneDirector.java @@ -34,7 +34,6 @@ import com.threerings.crowd.client.LocationDirector; import com.threerings.crowd.client.LocationObserver; import com.threerings.crowd.data.PlaceConfig; -import com.threerings.whirled.Log; import com.threerings.whirled.client.persist.SceneRepository; import com.threerings.whirled.data.Scene; import com.threerings.whirled.data.SceneCodes; @@ -44,6 +43,8 @@ import com.threerings.whirled.util.SceneFactory; import com.threerings.whirled.util.WhirledContext; import com.threerings.whirled.data.SceneUpdate; +import static com.threerings.whirled.Log.log; + /** * The scene director is the client's interface to all things scene related. It interfaces with the * scene repository to ensure that scene objects are available when the client enters a particular @@ -138,13 +139,13 @@ public class SceneDirector extends BasicDirector { // make sure the sceneId is valid if (sceneId < 0) { - Log.warning("Refusing moveTo(): invalid sceneId " + sceneId + "."); + log.warning("Refusing moveTo(): invalid sceneId " + sceneId + "."); return false; } // sanity-check the destination scene id if (sceneId == _sceneId) { - Log.warning("Refusing request to move to the same scene [sceneId=" + sceneId + "]."); + log.warning("Refusing request to move to the same scene [sceneId=" + sceneId + "]."); return false; } @@ -177,11 +178,11 @@ public class SceneDirector extends BasicDirector // complain if we're over-writing a pending request if (movePending()) { if (refuse) { - Log.warning("Refusing moveTo; We have a request outstanding " + + log.warning("Refusing moveTo; We have a request outstanding " + "[psid=" + _pendingSceneId + ", nsid=" + sceneId + "]."); return false; } else { - Log.warning("Overriding stale moveTo request [psid=" + _pendingSceneId + + log.warning("Overriding stale moveTo request [psid=" + _pendingSceneId + ", nsid=" + sceneId + "]."); } } @@ -232,7 +233,7 @@ public class SceneDirector extends BasicDirector // complain if we didn't find a scene if (_model == null) { - Log.warning("Aiya! Unable to load scene [sid=" + _sceneId + ", plid=" + placeId + "]."); + log.warning("Aiya! Unable to load scene [sid=" + _sceneId + ", plid=" + placeId + "]."); return; } @@ -243,7 +244,7 @@ public class SceneDirector extends BasicDirector // from interface SceneService.SceneMoveListener public void moveSucceededWithUpdates (int placeId, PlaceConfig config, SceneUpdate[] updates) { - Log.info("Got updates [placeId=" + placeId + ", config=" + config + + log.info("Got updates [placeId=" + placeId + ", config=" + config + ", updates=" + StringUtil.toString(updates) + "]."); // apply the updates to our cached scene @@ -253,7 +254,7 @@ public class SceneDirector extends BasicDirector try { updates[ii].validate(model); } catch (IllegalStateException ise) { - Log.warning("Scene update failed validation [model=" + model + + log.warning("Scene update failed validation [model=" + model + ", update=" + updates[ii] + ", error=" + ise.getMessage() + "]."); failure = true; break; @@ -262,9 +263,8 @@ public class SceneDirector extends BasicDirector try { updates[ii].apply(model); } catch (Exception e) { - Log.warning("Failure applying scene update [model=" + model + - ", update=" + updates[ii] + "]."); - Log.logStackTrace(e); + log.warning("Failure applying scene update [model=" + model + + ", update=" + updates[ii] + "].", e); failure = true; break; } @@ -275,9 +275,8 @@ public class SceneDirector extends BasicDirector try { _screp.deleteSceneModel(_pendingSceneId); } catch (IOException ioe) { - Log.warning("Failure removing booched scene model " + - "[sceneId=" + _pendingSceneId + "]."); - Log.logStackTrace(ioe); + log.warning("Failure removing booched scene model " + + "[sceneId=" + _pendingSceneId + "].", ioe); } // act as if the scene move failed; we'll be in a funny state because the server thinks @@ -296,7 +295,7 @@ public class SceneDirector extends BasicDirector // from interface SceneService.SceneMoveListener public void moveSucceededWithScene (int placeId, PlaceConfig config, SceneModel model) { - Log.info("Got updated scene model [placeId=" + placeId + ", config=" + config + + log.info("Got updated scene model [placeId=" + placeId + ", config=" + config + ", scene=" + model.sceneId + "/" + model.name + "/" + model.version + "]."); // update the model in the repository @@ -358,7 +357,7 @@ public class SceneDirector extends BasicDirector public void setMoveHandler (MoveHandler handler) { if (_moveHandler != null) { - Log.warning("Requested to set move handler, but we've already got one. The " + + log.warning("Requested to set move handler, but we've already got one. The " + "conflicting entities will likely need to perform more sophisticated " + "coordination to deal with failures. [old=" + _moveHandler + ", new=" + handler + "]."); @@ -375,12 +374,12 @@ public class SceneDirector extends BasicDirector // just finish up what we're doing and assume that the repeated move request was the // spurious one as it would be in the case of lag causing rapid-fire repeat requests if (movePending()) { - Log.info("Dropping forced move because we have a move pending " + + log.info("Dropping forced move because we have a move pending " + "[pendId=" + _pendingSceneId + ", reqId=" + sceneId + "]."); return; } - Log.info("Moving at request of server [sceneId=" + sceneId + "]."); + log.info("Moving at request of server [sceneId=" + sceneId + "]."); // clear out our old scene and place data didLeaveScene(); // move to the new scene @@ -424,7 +423,7 @@ public class SceneDirector extends BasicDirector } // issue a moveTo request - Log.info("Issuing moveTo(" + _pendingSceneId + ", " + sceneVers + ")."); + log.info("Issuing moveTo(" + _pendingSceneId + ", " + sceneVers + ")."); _sservice.moveTo(_ctx.getClient(), _pendingSceneId, sceneVers, this); } @@ -463,7 +462,7 @@ public class SceneDirector extends BasicDirector } catch (IOException ioe) { // complain first, then return null - Log.warning("Error loading scene [scid=" + sceneId + ", error=" + ioe + "]."); + log.warning("Error loading scene [scid=" + sceneId + ", error=" + ioe + "]."); } } @@ -479,9 +478,8 @@ public class SceneDirector extends BasicDirector try { _screp.storeSceneModel(model); } catch (IOException ioe) { - Log.warning("Failed to update repository with updated scene [sceneId=" + model.sceneId + - ", nvers=" + model.version + "]."); - Log.logStackTrace(ioe); + log.warning("Failed to update repository with updated scene [sceneId=" + model.sceneId + + ", nvers=" + model.version + "].", ioe); } } diff --git a/src/java/com/threerings/whirled/data/SceneImpl.java b/src/java/com/threerings/whirled/data/SceneImpl.java index 7d4ef460..e03338b8 100644 --- a/src/java/com/threerings/whirled/data/SceneImpl.java +++ b/src/java/com/threerings/whirled/data/SceneImpl.java @@ -23,7 +23,7 @@ package com.threerings.whirled.data; import com.threerings.crowd.data.PlaceConfig; -import com.threerings.whirled.Log; +import static com.threerings.whirled.Log.log; /** * An implementation of the {@link Scene} interface. @@ -99,9 +99,8 @@ public class SceneImpl implements Scene update.validate(_model); update.apply(_model); } catch (Exception e) { - Log.warning("Error applying update [scene=" + this + - ", update=" + update + "]."); - Log.logStackTrace(e); + log.warning("Error applying update [scene=" + this + + ", update=" + update + "].", e); } } diff --git a/src/java/com/threerings/whirled/data/SceneUpdate.java b/src/java/com/threerings/whirled/data/SceneUpdate.java index 87651393..097568a1 100644 --- a/src/java/com/threerings/whirled/data/SceneUpdate.java +++ b/src/java/com/threerings/whirled/data/SceneUpdate.java @@ -30,7 +30,7 @@ import com.threerings.io.ObjectOutputStream; import com.threerings.io.Streamable; import com.threerings.util.ActionScript; -import com.threerings.whirled.Log; +import static com.threerings.whirled.Log.log; /** * Used to encapsulate updates to scenes in such a manner that updates can be stored persistently @@ -109,7 +109,7 @@ public class SceneUpdate // sanity check for the amazing two billion updates if (model.version == _targetVersion) { - Log.warning("Egads! This scene has been updated two billion times [model=" + model + + log.warning("Egads! This scene has been updated two billion times [model=" + model + ", update=" + this + "]."); } } diff --git a/src/java/com/threerings/whirled/server/AbstractSceneMoveHandler.java b/src/java/com/threerings/whirled/server/AbstractSceneMoveHandler.java index 7cec37a6..137df85e 100644 --- a/src/java/com/threerings/whirled/server/AbstractSceneMoveHandler.java +++ b/src/java/com/threerings/whirled/server/AbstractSceneMoveHandler.java @@ -30,7 +30,7 @@ import com.threerings.crowd.data.BodyObject; import com.threerings.whirled.client.SceneService; import com.threerings.whirled.data.SceneCodes; -import com.threerings.whirled.Log; +import static com.threerings.whirled.Log.log; /** * Handles the basics of moving a client into a new scene, which may involve resolution. Takes care @@ -52,7 +52,7 @@ public abstract class AbstractSceneMoveHandler // make sure our caller is still around; under heavy load, clients might end their session // while the scene is resolving if (!_body.isActive()) { - Log.info("Abandoning scene move, client gone [who=" + _body.who() + + log.info("Abandoning scene move, client gone [who=" + _body.who() + ", dest=" + scmgr.where() + "]."); InvocationMarshaller.setNoResponse(_listener); return; @@ -65,7 +65,7 @@ public abstract class AbstractSceneMoveHandler _listener.requestFailed(sfe.getMessage()); } catch (RuntimeException re) { - Log.logStackTrace(re); + log.warning(re); _listener.requestFailed(SceneCodes.INTERNAL_ERROR); } } @@ -73,7 +73,7 @@ public abstract class AbstractSceneMoveHandler // from interface SceneRegistry.ResolutionListener public void sceneFailedToResolve (int sceneId, Exception reason) { - Log.warning("Unable to resolve scene [sceneid=" + sceneId + ", reason=" + reason + "]."); + log.warning("Unable to resolve scene [sceneid=" + sceneId + ", reason=" + reason + "]."); _listener.requestFailed(SceneCodes.NO_SUCH_PLACE); } diff --git a/src/java/com/threerings/whirled/server/SceneManager.java b/src/java/com/threerings/whirled/server/SceneManager.java index 55d871de..1789704e 100644 --- a/src/java/com/threerings/whirled/server/SceneManager.java +++ b/src/java/com/threerings/whirled/server/SceneManager.java @@ -28,7 +28,6 @@ import com.threerings.crowd.data.Place; import com.threerings.crowd.server.CrowdServer; import com.threerings.crowd.server.PlaceManager; -import com.threerings.whirled.Log; import com.threerings.whirled.data.Scene; import com.threerings.whirled.data.SceneCodes; import com.threerings.whirled.data.ScenePlace; @@ -36,6 +35,8 @@ import com.threerings.whirled.data.SceneUpdate; import com.threerings.whirled.server.WhirledServer; import com.threerings.whirled.util.UpdateList; +import static com.threerings.whirled.Log.log; + /** * The scene manager extends the place manager and takes care of basic scene services. Presently * that is little more than registering the scene manager with the scene registry so that the @@ -87,7 +88,7 @@ public class SceneManager extends PlaceManager // make sure the list and our version of the scene are in accordance if (!_updates.validate(scene.getVersion())) { - Log.warning("Provided with invalid updates; flushing [where=" + where() + + log.warning("Provided with invalid updates; flushing [where=" + where() + ", sceneId=" + scene.getId() + ", version=" + scene.getVersion() + "]."); // clear out the update list as it will not allow us to bring clients up to date with // our current scene version; instead they'll have to download the whole thing diff --git a/src/java/com/threerings/whirled/server/SceneRegistry.java b/src/java/com/threerings/whirled/server/SceneRegistry.java index 3551359e..faac9636 100644 --- a/src/java/com/threerings/whirled/server/SceneRegistry.java +++ b/src/java/com/threerings/whirled/server/SceneRegistry.java @@ -37,7 +37,6 @@ import com.threerings.crowd.server.CrowdServer; import com.threerings.crowd.server.PlaceManager; import com.threerings.crowd.server.PlaceRegistry; -import com.threerings.whirled.Log; import com.threerings.whirled.client.SceneService; import com.threerings.whirled.data.Scene; import com.threerings.whirled.data.SceneCodes; @@ -48,6 +47,8 @@ import com.threerings.whirled.util.NoSuchSceneException; import com.threerings.whirled.util.SceneFactory; import com.threerings.whirled.util.UpdateList; +import static com.threerings.whirled.Log.log; + /** * The scene registry is responsible for the management of all scenes. It handles interaction with * the scene repository and ensures that scenes are loaded into memory when needed and flushed from @@ -269,8 +270,7 @@ public class SceneRegistry { // if this is not simply a missing scene, log a warning if (!(cause instanceof NoSuchSceneException)) { - Log.info("Failed to resolve scene [sceneId=" + sceneId + ", cause=" + cause + "]."); - Log.logStackTrace(cause); + log.info("Failed to resolve scene [sceneId=" + sceneId + "].", cause); } // alas things didn't work out, notify our penders @@ -280,8 +280,7 @@ public class SceneRegistry try { rl.sceneFailedToResolve(sceneId, cause); } catch (Exception e) { - Log.warning("Resolution listener choked."); - Log.logStackTrace(e); + log.warning("Resolution listener choked.", e); } } } @@ -297,9 +296,7 @@ public class SceneRegistry int sceneId = scmgr.getScene().getId(); _scenemgrs.put(sceneId, scmgr); - if (Log.debug()) { - Log.debug("Registering scene manager [scid=" + sceneId + ", scmgr=" + scmgr + "]."); - } + log.debug("Registering scene manager", "scid", sceneId, "scmgr", scmgr); // now notify any penders ArrayList penders = _penders.remove(sceneId); @@ -308,8 +305,7 @@ public class SceneRegistry try { rl.sceneWasResolved(scmgr); } catch (Exception e) { - Log.warning("Resolution listener choked."); - Log.logStackTrace(e); + log.warning("Resolution listener choked.", e); } } } @@ -321,13 +317,11 @@ public class SceneRegistry protected void unmapSceneManager (SceneManager scmgr) { if (_scenemgrs.remove(scmgr.getScene().getId()) == null) { - Log.warning("Requested to unmap unmapped scene manager [scmgr=" + scmgr + "]."); + log.warning("Requested to unmap unmapped scene manager [scmgr=" + scmgr + "]."); return; } - if (Log.debug()) { - Log.debug("Unmapped scene manager " + scmgr + "."); - } + log.debug("Unmapped scene manager", "scmgr", scmgr); } /** The entity from which we load scene models. */ diff --git a/src/java/com/threerings/whirled/server/WhirledServer.java b/src/java/com/threerings/whirled/server/WhirledServer.java index e8795fcb..b541e33d 100644 --- a/src/java/com/threerings/whirled/server/WhirledServer.java +++ b/src/java/com/threerings/whirled/server/WhirledServer.java @@ -30,10 +30,11 @@ import com.threerings.presents.server.PresentsClient; import com.threerings.crowd.server.CrowdServer; -import com.threerings.whirled.Log; import com.threerings.whirled.server.persist.SceneRepository; import com.threerings.whirled.util.SceneFactory; +import static com.threerings.whirled.Log.log; + /** * The Whirled server extends the {@link CrowdServer} and provides access to managers and the like * that are needed by the Whirled serviecs. diff --git a/src/java/com/threerings/whirled/server/persist/DummySceneRepository.java b/src/java/com/threerings/whirled/server/persist/DummySceneRepository.java index 465995f6..4fa3bf1b 100644 --- a/src/java/com/threerings/whirled/server/persist/DummySceneRepository.java +++ b/src/java/com/threerings/whirled/server/persist/DummySceneRepository.java @@ -23,12 +23,13 @@ package com.threerings.whirled.server.persist; import com.samskivert.io.PersistenceException; -import com.threerings.whirled.Log; import com.threerings.whirled.data.SceneModel; import com.threerings.whirled.data.SceneUpdate; import com.threerings.whirled.util.NoSuchSceneException; import com.threerings.whirled.util.UpdateList; +import static com.threerings.whirled.Log.log; + /** * The dummy scene repository just pretends to load and store scenes, but * in fact it just creates new blank scenes when requested to load a scene @@ -40,7 +41,7 @@ public class DummySceneRepository implements SceneRepository public SceneModel loadSceneModel (int sceneId) throws PersistenceException, NoSuchSceneException { - Log.info("Creating dummy scene [id=" + sceneId + "]."); + log.info("Creating dummy scene [id=" + sceneId + "]."); return SceneModel.blankSceneModel(); } diff --git a/src/java/com/threerings/whirled/spot/Log.java b/src/java/com/threerings/whirled/spot/Log.java index a8d68a4a..9f76dbcd 100644 --- a/src/java/com/threerings/whirled/spot/Log.java +++ b/src/java/com/threerings/whirled/spot/Log.java @@ -21,36 +21,12 @@ package com.threerings.whirled.spot; +import com.samskivert.util.Logger; + /** - * A placeholder class that contains a reference to the log object used by - * the Whirled Spot services. + * Contains a reference to the log object used by the Whirled Spot services. */ public class Log { - public static com.samskivert.util.Log log = - new com.samskivert.util.Log("whirled.spot"); - - /** Convenience function. */ - public static void debug (String message) - { - log.debug(message); - } - - /** Convenience function. */ - public static void info (String message) - { - log.info(message); - } - - /** Convenience function. */ - public static void warning (String message) - { - log.warning(message); - } - - /** Convenience function. */ - public static void logStackTrace (Throwable t) - { - log.logStackTrace(com.samskivert.util.Log.WARNING, t); - } + public static Logger log = Logger.getLogger("com.threerings.whirled.spot"); } diff --git a/src/java/com/threerings/whirled/spot/client/SpotSceneDirector.java b/src/java/com/threerings/whirled/spot/client/SpotSceneDirector.java index 59b4b50e..69c12135 100644 --- a/src/java/com/threerings/whirled/spot/client/SpotSceneDirector.java +++ b/src/java/com/threerings/whirled/spot/client/SpotSceneDirector.java @@ -46,13 +46,14 @@ import com.threerings.whirled.data.SceneModel; import com.threerings.whirled.data.ScenePlace; import com.threerings.whirled.util.WhirledContext; -import com.threerings.whirled.spot.Log; import com.threerings.whirled.spot.data.ClusteredBodyObject; import com.threerings.whirled.spot.data.Location; import com.threerings.whirled.spot.data.Portal; import com.threerings.whirled.spot.data.SpotCodes; import com.threerings.whirled.spot.data.SpotScene; +import static com.threerings.whirled.spot.Log.log; + /** * Extends the standard scene director with facilities to move between locations within a scene. */ @@ -124,7 +125,7 @@ public class SpotSceneDirector extends BasicDirector // look up the destination scene and location SpotScene scene = (SpotScene)_scdir.getScene(); if (scene == null) { - Log.warning("Requested to traverse portal when we have no scene " + + log.warning("Requested to traverse portal when we have no scene " + "[portalId=" + portalId + "]."); return false; } @@ -133,7 +134,7 @@ public class SpotSceneDirector extends BasicDirector int sceneId = _scdir.getScene().getId(); int clSceneId = ScenePlace.getSceneId((BodyObject)_ctx.getClient().getClientObject()); if (sceneId != clSceneId) { - Log.warning("Client and server differ in opinion of what scene we're in " + + log.warning("Client and server differ in opinion of what scene we're in " + "[sSceneId=" + clSceneId + ", cSceneId=" + sceneId + "]."); return false; } @@ -141,14 +142,14 @@ public class SpotSceneDirector extends BasicDirector // find the portal they're talking about Portal dest = scene.getPortal(portalId); if (dest == null) { - Log.warning("Requested to traverse non-existent portal [portalId=" + portalId + + log.warning("Requested to traverse non-existent portal [portalId=" + portalId + ", portals=" + StringUtil.toString(scene.getPortals()) + "]."); return false; } // prepare to move to this scene (sets up pending data) if (!_scdir.prepareMoveTo(dest.targetSceneId, rl)) { - Log.info("Portal traversal vetoed by scene director [portalId=" + portalId + "]."); + log.info("Portal traversal vetoed by scene director [portalId=" + portalId + "]."); return false; } @@ -161,7 +162,7 @@ public class SpotSceneDirector extends BasicDirector } // issue a traversePortal request - Log.info("Issuing traversePortal(" + sceneId + ", " + dest + ", " + sceneVer + ")."); + log.info("Issuing traversePortal(" + sceneId + ", " + dest + ", " + sceneVer + ")."); _sservice.traversePortal(_ctx.getClient(), sceneId, portalId, sceneVer, _scdir); return true; } @@ -181,7 +182,7 @@ public class SpotSceneDirector extends BasicDirector // refuse if there's a pending location change or if we're already at the specified // location if (loc.equivalent(_location)) { - Log.info("Not going to " + loc + "; we're at " + _location + " and we're headed to " + + log.info("Not going to " + loc + "; we're at " + _location + " and we're headed to " + _pendingLoc + "."); if (listener != null) { // This isn't really a failure, it's just a no-op. @@ -191,7 +192,7 @@ public class SpotSceneDirector extends BasicDirector } if (_pendingLoc != null) { - Log.info("Not going to " + loc + "; we're at " + _location + " and we're headed to " + + log.info("Not going to " + loc + "; we're at " + _location + " and we're headed to " + _pendingLoc + "."); if (listener != null) { // Already moving, best thing to do is ignore it. @@ -202,7 +203,7 @@ public class SpotSceneDirector extends BasicDirector SpotScene scene = (SpotScene)_scdir.getScene(); if (scene == null) { - Log.warning("Requested to change locations, but we're not currently in any scene " + + log.warning("Requested to change locations, but we're not currently in any scene " + "[loc=" + loc + "]."); if (listener != null) { listener.requestFailed(new Exception("m.cant_get_there")); @@ -211,7 +212,7 @@ public class SpotSceneDirector extends BasicDirector } int sceneId = _scdir.getScene().getId(); - Log.info("Sending changeLocation request [scid=" + sceneId + ", loc=" + loc + "]."); + log.info("Sending changeLocation request [scid=" + sceneId + ", loc=" + loc + "]."); _pendingLoc = (Location)loc.clone(); ConfirmListener clist = new ConfirmListener() { @@ -245,7 +246,7 @@ public class SpotSceneDirector extends BasicDirector { SpotScene scene = (SpotScene)_scdir.getScene(); if (scene == null) { - Log.warning("Requested to join cluster, but we're not currently in any scene " + + log.warning("Requested to join cluster, but we're not currently in any scene " + "[froid=" + froid + "]."); if (listener != null) { listener.requestFailed(new Exception("m.cant_get_there")); @@ -253,7 +254,7 @@ public class SpotSceneDirector extends BasicDirector return; } - Log.info("Joining cluster [friend=" + froid + "]."); + log.info("Joining cluster [friend=" + froid + "]."); _sservice.joinCluster(_ctx.getClient(), froid, new ConfirmListener() { public void requestProcessed () { @@ -293,14 +294,14 @@ public class SpotSceneDirector extends BasicDirector // make sure we're currently in a scene SpotScene scene = (SpotScene)_scdir.getScene(); if (scene == null) { - Log.warning("Requested to speak to cluster, but we're not currently in any scene " + + log.warning("Requested to speak to cluster, but we're not currently in any scene " + "[message=" + message + "]."); return false; } // make sure we're part of a cluster if (_self.getClusterOid() <= 0) { - Log.info("Ignoring cluster speak as we're not in a cluster " + + log.info("Ignoring cluster speak as we're not in a cluster " + "[cloid=" + _self.getClusterOid() + "]."); return false; } @@ -333,7 +334,7 @@ public class SpotSceneDirector extends BasicDirector // documentation inherited from interface public void requestFailed (int oid, ObjectAccessException cause) { - Log.warning("Unable to subscribe to cluster chat object [oid=" + oid + + log.warning("Unable to subscribe to cluster chat object [oid=" + oid + ", cause=" + cause + "]."); } diff --git a/src/java/com/threerings/whirled/spot/data/SpotSceneImpl.java b/src/java/com/threerings/whirled/spot/data/SpotSceneImpl.java index 35e93100..3a46cb24 100644 --- a/src/java/com/threerings/whirled/spot/data/SpotSceneImpl.java +++ b/src/java/com/threerings/whirled/spot/data/SpotSceneImpl.java @@ -25,7 +25,7 @@ import java.util.Iterator; import com.samskivert.util.HashIntMap; -import com.threerings.whirled.spot.Log; +import static com.threerings.whirled.spot.Log.log; /** * An implementation of the {@link SpotScene} interface. @@ -103,7 +103,7 @@ public class SpotSceneImpl public void addPortal (Portal portal) { if (portal.portalId <= 0) { - Log.warning("Refusing to add zero-id portal " + + log.warning("Refusing to add zero-id portal " + "[scene=" + this + ", portal=" + portal + "]."); return; } diff --git a/src/java/com/threerings/whirled/spot/server/SpotProvider.java b/src/java/com/threerings/whirled/spot/server/SpotProvider.java index 297dcb8f..00e54c66 100644 --- a/src/java/com/threerings/whirled/spot/server/SpotProvider.java +++ b/src/java/com/threerings/whirled/spot/server/SpotProvider.java @@ -37,13 +37,14 @@ import com.threerings.util.Name; import com.threerings.whirled.client.SceneService.SceneMoveListener; import com.threerings.whirled.data.ScenePlace; import com.threerings.whirled.server.SceneRegistry; -import com.threerings.whirled.spot.Log; import com.threerings.whirled.spot.client.SpotService; import com.threerings.whirled.spot.data.Location; import com.threerings.whirled.spot.data.Portal; import com.threerings.whirled.spot.data.SpotCodes; import com.threerings.whirled.spot.data.SpotScene; +import static com.threerings.whirled.spot.Log.log; + /** * Provides the server-side implementation of the spot services. */ @@ -73,7 +74,7 @@ public class SpotProvider BodyObject body = (BodyObject)caller; int cSceneId = ScenePlace.getSceneId(body); if (cSceneId != sceneId) { - Log.info("Ignoring stale traverse portal request [caller=" + caller.who() + + log.info("Ignoring stale traverse portal request [caller=" + caller.who() + ", oSceneId=" + sceneId + ", portalId=" + portalId + ", cSceneId=" + cSceneId + "]."); InvocationMarshaller.setNoResponse(listener); @@ -83,7 +84,7 @@ public class SpotProvider // obtain the source scene SpotSceneManager srcmgr = (SpotSceneManager)_screg.getSceneManager(sceneId); if (srcmgr == null) { - Log.warning("Traverse portal missing source scene " + + log.warning("Traverse portal missing source scene " + "[user=" + body.who() + ", sceneId=" + sceneId + ", portalId=" + portalId + "]."); throw new InvocationException(INTERNAL_ERROR); @@ -101,7 +102,7 @@ public class SpotProvider // make sure this portal has valid info if (dest == null || !dest.isValid()) { - Log.warning("Traverse portal with invalid portal [user=" + body.who() + + log.warning("Traverse portal with invalid portal [user=" + body.who() + ", scene=" + srcmgr.where() + ", pid=" + portalId + ", portal=" + dest + ", portals=" + StringUtil.toString(rss.getPortals()) + "]."); throw new InvocationException(NO_SUCH_PORTAL); @@ -122,7 +123,7 @@ public class SpotProvider BodyObject source = (BodyObject)caller; int cSceneId = ScenePlace.getSceneId(source); if (cSceneId != sceneId) { - Log.info("Rejecting changeLocation for invalid scene [user=" + source.who() + + log.info("Rejecting changeLocation for invalid scene [user=" + source.who() + ", insid=" + cSceneId + ", wantsid=" + sceneId + ", loc=" + loc + "]."); throw new InvocationException(INVALID_LOCATION); } @@ -130,7 +131,7 @@ public class SpotProvider // look up the scene manager for the specified scene SpotSceneManager smgr = (SpotSceneManager)_screg.getSceneManager(sceneId); if (smgr == null) { - Log.warning("User requested to change location from non-existent scene " + + log.warning("User requested to change location from non-existent scene " + "[user=" + source.who() + ", sceneId=" + sceneId + ", loc=" + loc +"]."); throw new InvocationException(INTERNAL_ERROR); } @@ -155,7 +156,7 @@ public class SpotProvider // look up the scene manager for the specified scene SpotSceneManager smgr = (SpotSceneManager)_screg.getSceneManager(sceneId); if (smgr == null) { - Log.warning("User requested to join cluster from non-existent scene " + + log.warning("User requested to join cluster from non-existent scene " + "[user=" + source.who() + ", sceneId=" + sceneId + ", foid=" + friendOid +"]."); throw new InvocationException(INTERNAL_ERROR); @@ -223,7 +224,7 @@ public class SpotProvider // look up the scene manager for the specified scene SpotSceneManager smgr = (SpotSceneManager)_screg.getSceneManager(sceneId); if (smgr == null) { - Log.warning("User requested cluster chat in non-existent scene " + + log.warning("User requested cluster chat in non-existent scene " + "[user=" + message.speaker + ", sceneId=" + sceneId + ", message=" + message + "]."); return; diff --git a/src/java/com/threerings/whirled/spot/server/SpotSceneManager.java b/src/java/com/threerings/whirled/spot/server/SpotSceneManager.java index 13937863..f0ada765 100644 --- a/src/java/com/threerings/whirled/spot/server/SpotSceneManager.java +++ b/src/java/com/threerings/whirled/spot/server/SpotSceneManager.java @@ -25,16 +25,19 @@ import java.util.HashMap; import java.util.Iterator; import com.samskivert.util.HashIntMap; +import com.threerings.util.Name; + +import com.threerings.presents.dobj.DObject; +import com.threerings.presents.server.InvocationException; + import com.threerings.crowd.chat.data.UserMessage; import com.threerings.crowd.chat.server.SpeakUtil; import com.threerings.crowd.data.BodyObject; import com.threerings.crowd.data.OccupantInfo; import com.threerings.crowd.server.CrowdServer; -import com.threerings.presents.dobj.DObject; -import com.threerings.presents.server.InvocationException; -import com.threerings.util.Name; + import com.threerings.whirled.server.SceneManager; -import com.threerings.whirled.spot.Log; + import com.threerings.whirled.spot.data.Cluster; import com.threerings.whirled.spot.data.ClusterObject; import com.threerings.whirled.spot.data.ClusteredBodyObject; @@ -45,6 +48,8 @@ import com.threerings.whirled.spot.data.SpotCodes; import com.threerings.whirled.spot.data.SpotScene; import com.threerings.whirled.spot.data.SpotSceneObject; +import static com.threerings.whirled.spot.Log.log; + /** * Handles the movement of bodies between locations in the scene and creates the necessary * distributed objects to allow bodies in clusters to chat with one another. @@ -143,7 +148,7 @@ public class SpotSceneManager extends SceneManager while (cliter.hasNext()) { ClusterRecord clrec = cliter.next(); if (clrec.containsKey(bodyOid)) { - Log.info("Pruning departed body from cluster [boid=" + bodyOid + + log.info("Pruning departed body from cluster [boid=" + bodyOid + ", cluster=" + clrec + "]."); clrec.removeBody(bodyOid); if (clrec.size() == 0) { @@ -176,7 +181,7 @@ public class SpotSceneManager extends SceneManager if (from != null && from.targetPortalId != -1) { entry = _sscene.getPortal(from.targetPortalId); if (entry == null) { - Log.warning("Body mapped at invalid portal [where=" + where() + + log.warning("Body mapped at invalid portal [where=" + where() + ", who=" + body.who() + ", from=" + from + "]."); entry = _sscene.getDefaultEntrance(); } @@ -212,7 +217,7 @@ public class SpotSceneManager extends SceneManager { SpotScene scene = (SpotScene)getScene(); if (scene == null) { - Log.warning("No scene in moveBodyToDefaultPortal()? [who=" + body.who() + + log.warning("No scene in moveBodyToDefaultPortal()? [who=" + body.who() + ", where=" + where() + "]."); return; } @@ -221,7 +226,7 @@ public class SpotSceneManager extends SceneManager Location eloc = scene.getDefaultEntrance().getLocation(); handleChangeLoc(body, eloc); } catch (InvocationException ie) { - Log.warning("Could not move user to default portal [where=" + where() + + log.warning("Could not move user to default portal [where=" + where() + ", who=" + body.who() + ", error=" + ie + "]."); } } @@ -241,7 +246,7 @@ public class SpotSceneManager extends SceneManager { // make sure they are in our scene if (!_ssobj.occupants.contains(source.getOid())) { - Log.warning("Refusing change loc from non-scene occupant [where=" + where() + + log.warning("Refusing change loc from non-scene occupant [where=" + where() + ", who=" + source.who() + ", loc=" + loc + "]."); throw new InvocationException(INTERNAL_ERROR); } @@ -277,7 +282,7 @@ public class SpotSceneManager extends SceneManager SceneLocation sloc = new SceneLocation(loc, source.getOid()); if (!_ssobj.occupantLocs.contains(sloc)) { // complain if they don't already have a location configured - Log.warning("Changing loc for occupant without previous loc [where=" + where() + + log.warning("Changing loc for occupant without previous loc [where=" + where() + ", who=" + source.who() + ", nloc=" + loc + "]."); Thread.dumpStack(); _ssobj.addToOccupantLocs(sloc); @@ -310,7 +315,7 @@ public class SpotSceneManager extends SceneManager // otherwise see if they sent us the user's oid DObject tobj = CrowdServer.omgr.getObject(targetOid); if (!(tobj instanceof BodyObject)) { - Log.info("Can't join cluster, missing target [creator=" + joiner.who() + + log.info("Can't join cluster, missing target [creator=" + joiner.who() + ", targetOid=" + targetOid + "]."); throw new InvocationException(NO_SUCH_CLUSTER); } @@ -318,7 +323,7 @@ public class SpotSceneManager extends SceneManager // make sure we're in the same scene as said user BodyObject friend = (BodyObject)tobj; if (friend.getPlaceOid() != joiner.getPlaceOid()) { - Log.info("Refusing cluster join from non-proximate user [joiner=" + joiner.who() + + log.info("Refusing cluster join from non-proximate user [joiner=" + joiner.who() + ", jloc=" + joiner.location + ", target=" + friend.who() + ", tloc=" + friend.location + "]."); throw new InvocationException(NO_SUCH_CLUSTER); @@ -405,7 +410,7 @@ public class SpotSceneManager extends SceneManager { ClusterRecord clrec = getCluster(sourceOid); if (clrec == null) { - Log.warning("Non-clustered user requested cluster speak [where=" + where() + + log.warning("Non-clustered user requested cluster speak [where=" + where() + ", chatter=" + message.speaker + " (" + sourceOid + "), " + "msg=" + message + "]."); } else { @@ -472,7 +477,7 @@ public class SpotSceneManager extends SceneManager throws InvocationException { if (!(body instanceof ClusteredBodyObject)) { - Log.warning("Refusing to add non-clustered body to cluster [cloid=" + + log.warning("Refusing to add non-clustered body to cluster [cloid=" + _clobj.getOid() + ", size=" + size() + ", who=" + body.who() + "]."); throw new InvocationException(INTERNAL_ERROR); } @@ -518,7 +523,7 @@ public class SpotSceneManager extends SceneManager { BodyObject body = (BodyObject)remove(bodyOid); if (body == null) { - Log.warning("Requested to remove unknown body from cluster [cloid=" + + log.warning("Requested to remove unknown body from cluster [cloid=" + _clobj.getOid() + ", size=" + size() + ", who=" + bodyOid + "]."); return; } diff --git a/src/java/com/threerings/whirled/spot/tools/xml/SpotSceneWriter.java b/src/java/com/threerings/whirled/spot/tools/xml/SpotSceneWriter.java index a2260524..a2657185 100644 --- a/src/java/com/threerings/whirled/spot/tools/xml/SpotSceneWriter.java +++ b/src/java/com/threerings/whirled/spot/tools/xml/SpotSceneWriter.java @@ -29,11 +29,12 @@ import org.xml.sax.helpers.AttributesImpl; import com.megginson.sax.DataWriter; import com.threerings.tools.xml.NestableWriter; -import com.threerings.whirled.spot.Log; import com.threerings.whirled.spot.data.Location; import com.threerings.whirled.spot.data.SpotSceneModel; import com.threerings.whirled.spot.tools.EditablePortal; +import static com.threerings.whirled.spot.Log.log; + /** * Generates an XML representation of a {@link SpotSceneModel}. */ @@ -93,7 +94,7 @@ public class SpotSceneWriter attrs.addAttribute("", fields[ii].getName(), "", "", String.valueOf(fields[ii].get(portalLoc))); } catch (IllegalAccessException iae) { - Log.warning("Unable to write portal field, skipping " + + log.warning("Unable to write portal field, skipping " + "[field=" + fields[ii].getName() + ", e=" + iae + "]."); } } diff --git a/src/java/com/threerings/whirled/tools/xml/SceneWriter.java b/src/java/com/threerings/whirled/tools/xml/SceneWriter.java index 07d26707..ac50d131 100644 --- a/src/java/com/threerings/whirled/tools/xml/SceneWriter.java +++ b/src/java/com/threerings/whirled/tools/xml/SceneWriter.java @@ -32,10 +32,11 @@ import org.xml.sax.helpers.AttributesImpl; import com.megginson.sax.DataWriter; import com.threerings.tools.xml.NestableWriter; -import com.threerings.whirled.Log; import com.threerings.whirled.data.AuxModel; import com.threerings.whirled.data.SceneModel; +import static com.threerings.whirled.Log.log; + /** * Generates an XML representation of an {@link SceneModel}. */ @@ -111,7 +112,7 @@ public class SceneWriter if (awriter != null) { awriter.write(amodel, writer); } else { - Log.warning("No writer registered for auxiliary scene model " + + log.warning("No writer registered for auxiliary scene model " + "[mclass=" + amodel.getClass() + "]."); } } diff --git a/src/java/com/threerings/whirled/util/UpdateList.java b/src/java/com/threerings/whirled/util/UpdateList.java index 885768b3..56571ccc 100644 --- a/src/java/com/threerings/whirled/util/UpdateList.java +++ b/src/java/com/threerings/whirled/util/UpdateList.java @@ -25,9 +25,10 @@ import java.util.List; import com.google.common.collect.Lists; -import com.threerings.whirled.Log; import com.threerings.whirled.data.SceneUpdate; +import static com.threerings.whirled.Log.log; + /** * A list specialized for storing {@link SceneUpdate} objects. */ @@ -51,7 +52,7 @@ public class UpdateList int expVersion = last.getSceneVersion() + last.getVersionIncrement(); int gotVersion = update.getSceneVersion(); if (gotVersion > expVersion) { - Log.warning("Update continuity broken, flushing list [got=" + update + + log.warning("Update continuity broken, flushing list [got=" + update + ", expect=" + expVersion + ", ucount=" + _updates.size() + "]."); _updates.clear(); // flush out our old updates, fall through and add this one diff --git a/src/java/com/threerings/whirled/zone/Log.java b/src/java/com/threerings/whirled/zone/Log.java index cb10020f..45b7b585 100644 --- a/src/java/com/threerings/whirled/zone/Log.java +++ b/src/java/com/threerings/whirled/zone/Log.java @@ -21,36 +21,12 @@ package com.threerings.whirled.zone; +import com.samskivert.util.Logger; + /** - * A placeholder class that contains a reference to the log object used by - * the Whirled Zone services. + * Contains a reference to the log object used by the Whirled Zone services. */ public class Log { - public static com.samskivert.util.Log log = - new com.samskivert.util.Log("whirled.zone"); - - /** Convenience function. */ - public static void debug (String message) - { - log.debug(message); - } - - /** Convenience function. */ - public static void info (String message) - { - log.info(message); - } - - /** Convenience function. */ - public static void warning (String message) - { - log.warning(message); - } - - /** Convenience function. */ - public static void logStackTrace (Throwable t) - { - log.logStackTrace(com.samskivert.util.Log.WARNING, t); - } + public static Logger log = Logger.getLogger("com.threerings.whirled.zone"); } diff --git a/src/java/com/threerings/whirled/zone/client/ZoneDirector.java b/src/java/com/threerings/whirled/zone/client/ZoneDirector.java index 54cfc714..d41c380e 100644 --- a/src/java/com/threerings/whirled/zone/client/ZoneDirector.java +++ b/src/java/com/threerings/whirled/zone/client/ZoneDirector.java @@ -35,10 +35,11 @@ import com.threerings.whirled.data.SceneModel; import com.threerings.whirled.data.SceneUpdate; import com.threerings.whirled.util.WhirledContext; -import com.threerings.whirled.zone.Log; import com.threerings.whirled.zone.data.ZoneSummary; import com.threerings.whirled.zone.util.ZoneUtil; +import static com.threerings.whirled.zone.Log.log; + /** * The zone director augments the scene services with the notion of zones. Zones are * self-contained, connected groups of scenes. The normal scene director services can be used to @@ -112,7 +113,7 @@ public class ZoneDirector extends BasicDirector { // make sure the zoneId and sceneId are valid if (zoneId < 0 || sceneId < 0) { - Log.warning("Refusing moveTo(): invalid sceneId or zoneId " + + log.warning("Refusing moveTo(): invalid sceneId or zoneId " + "[zoneId=" + zoneId + ", sceneId=" + sceneId + "]."); return false; } @@ -141,7 +142,7 @@ public class ZoneDirector extends BasicDirector } // issue a moveTo request - Log.info("Issuing zoned moveTo(" + ZoneUtil.toString(zoneId) + + log.info("Issuing zoned moveTo(" + ZoneUtil.toString(zoneId) + ", " + sceneId + ", " + sceneVers + ")."); _zservice.moveTo(_ctx.getClient(), zoneId, sceneId, sceneVers, this); return true; @@ -227,13 +228,13 @@ public class ZoneDirector extends BasicDirector // just finish up what we're doing and assume that the repeated move request was the // spurious one as it would be in the case of lag causing rapid-fire repeat requests if (_scdir.movePending()) { - Log.info("Dropping forced move because we have a move pending " + + log.info("Dropping forced move because we have a move pending " + "[pend=" + _scdir.getPendingModel() + ", rzId=" + zoneId + ", rsId=" + sceneId + "]."); return; } - Log.info("Moving at request of server [zoneId=" + zoneId + ", sceneId=" + sceneId + "]."); + log.info("Moving at request of server [zoneId=" + zoneId + ", sceneId=" + sceneId + "]."); // clear out our old scene and place data _scdir.didLeaveScene(); // move to the new zone and scene @@ -272,9 +273,8 @@ public class ZoneDirector extends BasicDirector } } catch (Throwable t) { - Log.warning("Zone observer choked during notification [data=" + data + - ", obs=" + obs + "]."); - Log.logStackTrace(t); + log.warning("Zone observer choked during notification [data=" + data + + ", obs=" + obs + "].", t); } } } diff --git a/src/java/com/threerings/whirled/zone/server/ZoneMoveHandler.java b/src/java/com/threerings/whirled/zone/server/ZoneMoveHandler.java index 93059bdb..855b3e56 100644 --- a/src/java/com/threerings/whirled/zone/server/ZoneMoveHandler.java +++ b/src/java/com/threerings/whirled/zone/server/ZoneMoveHandler.java @@ -35,12 +35,13 @@ import com.threerings.whirled.server.SceneMoveHandler; import com.threerings.whirled.server.SceneRegistry; import com.threerings.whirled.server.WhirledServer; -import com.threerings.whirled.zone.Log; import com.threerings.whirled.zone.client.ZoneService; import com.threerings.whirled.zone.data.ZoneCodes; import com.threerings.whirled.zone.data.ZoneSummary; import com.threerings.whirled.zone.data.ZonedBodyObject; +import static com.threerings.whirled.zone.Log.log; + /** * Handles transitioning between zones. */ @@ -74,7 +75,7 @@ public class ZoneMoveHandler extends AbstractSceneMoveHandler // from interface ZoneManager.ResolutionListener public void zoneFailedToResolve (int zoneId, Exception reason) { - Log.warning("Unable to resolve zone [zoneId=" + zoneId + ", reason=" + reason + "]."); + log.warning("Unable to resolve zone [zoneId=" + zoneId + ", reason=" + reason + "]."); _listener.requestFailed(ZoneCodes.NO_SUCH_ZONE); } diff --git a/src/java/com/threerings/whirled/zone/server/ZoneProvider.java b/src/java/com/threerings/whirled/zone/server/ZoneProvider.java index 752405a7..94ba4add 100644 --- a/src/java/com/threerings/whirled/zone/server/ZoneProvider.java +++ b/src/java/com/threerings/whirled/zone/server/ZoneProvider.java @@ -36,12 +36,13 @@ import com.threerings.whirled.data.SceneUpdate; import com.threerings.whirled.server.SceneManager; import com.threerings.whirled.server.SceneRegistry; -import com.threerings.whirled.zone.Log; import com.threerings.whirled.zone.client.ZoneService.ZoneMoveListener; import com.threerings.whirled.zone.data.ZoneCodes; import com.threerings.whirled.zone.data.ZoneSummary; import com.threerings.whirled.zone.data.ZonedBodyObject; +import static com.threerings.whirled.zone.Log.log; + /** * Provides zone related services which are presently the ability to move from zone to zone. */ @@ -74,7 +75,7 @@ public class ZoneProvider throws InvocationException { if (!(caller instanceof ZonedBodyObject)) { - Log.warning("Request to switch zones by non-ZonedBodyObject " + + log.warning("Request to switch zones by non-ZonedBodyObject " + "[clobj=" + caller.getClass() + "]."); throw new InvocationException(INTERNAL_ERROR); } @@ -93,7 +94,7 @@ public class ZoneProvider // look up the zone manager for the zone ZoneManager zmgr = _zonereg.getZoneManager(zoneId); if (zmgr == null) { - Log.warning("Requested to enter a zone for which we have no manager " + + log.warning("Requested to enter a zone for which we have no manager " + "[user=" + body.who() + ", zoneId=" + zoneId + "]."); throw new InvocationException(NO_SUCH_ZONE); } diff --git a/src/java/com/threerings/whirled/zone/server/ZoneRegistry.java b/src/java/com/threerings/whirled/zone/server/ZoneRegistry.java index 78147c66..0e454f18 100644 --- a/src/java/com/threerings/whirled/zone/server/ZoneRegistry.java +++ b/src/java/com/threerings/whirled/zone/server/ZoneRegistry.java @@ -28,10 +28,11 @@ import com.threerings.presents.server.InvocationManager; import com.threerings.crowd.server.PlaceRegistry; import com.threerings.whirled.server.SceneRegistry; -import com.threerings.whirled.zone.Log; import com.threerings.whirled.zone.data.ZoneCodes; import com.threerings.whirled.zone.util.ZoneUtil; +import static com.threerings.whirled.zone.Log.log; + /** * The zone registry takes care of mapping zone requests to the appropriate registered zone * manager. @@ -61,7 +62,7 @@ public class ZoneRegistry { ZoneManager old = (ZoneManager)_managers.get(zoneType); if (old != null) { - Log.warning("Zone manager already registered with requested type [type=" + zoneType + + log.warning("Zone manager already registered with requested type [type=" + zoneType + ", old=" + old + ", new=" + manager + "]."); } else { _managers.put(zoneType, manager); diff --git a/tests/src/java/com/threerings/parlor/TestClient.java b/tests/src/java/com/threerings/parlor/TestClient.java index 33d51dad..31ebaa14 100644 --- a/tests/src/java/com/threerings/parlor/TestClient.java +++ b/tests/src/java/com/threerings/parlor/TestClient.java @@ -30,12 +30,13 @@ import com.threerings.crowd.client.*; import com.threerings.crowd.data.BodyObject; import com.threerings.crowd.util.CrowdContext; -import com.threerings.parlor.Log; import com.threerings.parlor.client.*; import com.threerings.parlor.game.client.*; import com.threerings.parlor.game.data.*; import com.threerings.parlor.util.ParlorContext; +import static com.threerings.parlor.Log.log; + public class TestClient extends com.threerings.crowd.client.TestClient implements InvitationHandler, InvitationResponseObserver { @@ -54,7 +55,7 @@ public class TestClient extends com.threerings.crowd.client.TestClient { // we intentionally don't call super() - Log.info("Client did logon [client=" + client + "]."); + log.info("Client did logon [client=" + client + "]."); // get a casted reference to our body object _body = (BodyObject)client.getClientObject(); @@ -69,7 +70,7 @@ public class TestClient extends com.threerings.crowd.client.TestClient public void invitationReceived (Invitation invite) { - Log.info("Invitation received [invite=" + invite + "]."); + log.info("Invitation received [invite=" + invite + "]."); // accept the invitation. we're game... invite.accept(); @@ -77,23 +78,23 @@ public class TestClient extends com.threerings.crowd.client.TestClient public void invitationCancelled (Invitation invite) { - Log.info("Invitation cancelled [invite=" + invite + "]."); + log.info("Invitation cancelled [invite=" + invite + "]."); } public void invitationAccepted (Invitation invite) { - Log.info("Invitation accepted [invite=" + invite + "]."); + log.info("Invitation accepted [invite=" + invite + "]."); } public void invitationRefused (Invitation invite, String message) { - Log.info("Invitation refused [invite=" + invite + + log.info("Invitation refused [invite=" + invite + ", message=" + message + "]."); } public void invitationCountered (Invitation invite, GameConfig config) { - Log.info("Invitation countered [invite=" + invite + + log.info("Invitation countered [invite=" + invite + ", config=" + config + "]."); } diff --git a/tests/src/java/com/threerings/parlor/TestServer.java b/tests/src/java/com/threerings/parlor/TestServer.java index cef5ba14..a3b9d895 100644 --- a/tests/src/java/com/threerings/parlor/TestServer.java +++ b/tests/src/java/com/threerings/parlor/TestServer.java @@ -23,9 +23,10 @@ package com.threerings.parlor; import com.threerings.crowd.server.CrowdServer; -import com.threerings.parlor.Log; import com.threerings.parlor.server.ParlorManager; +import static com.threerings.parlor.Log.log; + /** * A test server for the Parlor services. */ @@ -43,7 +44,7 @@ public class TestServer extends CrowdServer // initialize our parlor manager parmgr.init(invmgr, plreg); - Log.info("Parlor server initialized."); + log.info("Parlor server initialized."); } /** Main entry point for test server. */ @@ -54,8 +55,7 @@ public class TestServer extends CrowdServer server.init(); server.run(); } catch (Exception e) { - Log.warning("Unable to initialize server."); - Log.logStackTrace(e); + log.warning("Unable to initialize server.", e); } } } diff --git a/tests/src/java/com/threerings/whirled/DummyClientSceneRepository.java b/tests/src/java/com/threerings/whirled/DummyClientSceneRepository.java index 0aab9769..b460d930 100644 --- a/tests/src/java/com/threerings/whirled/DummyClientSceneRepository.java +++ b/tests/src/java/com/threerings/whirled/DummyClientSceneRepository.java @@ -23,11 +23,12 @@ package com.threerings.whirled; import java.io.IOException; -import com.threerings.whirled.Log; import com.threerings.whirled.client.persist.SceneRepository; import com.threerings.whirled.data.SceneModel; import com.threerings.whirled.util.NoSuchSceneException; +import static com.threerings.whirled.Log.log; + /** * The dummy scene repository just pretends to load and store scenes, but * in fact it just creates new blank scenes when requested to load a scene @@ -39,7 +40,7 @@ public class DummyClientSceneRepository implements SceneRepository public SceneModel loadSceneModel (int sceneId) throws IOException, NoSuchSceneException { - Log.info("Creating dummy scene model [id=" + sceneId + "]."); + log.info("Creating dummy scene model [id=" + sceneId + "]."); return new SceneModel(); }