From d675a1612e1045ff281b7ae45451f0a3709e26f8 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Mon, 22 Sep 2003 23:57:20 +0000 Subject: [PATCH] Cleaning up more straining debugging. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2803 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/java/com/threerings/whirled/Log.java | 8 ++++++- .../whirled/server/SceneRegistry.java | 21 +++++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/java/com/threerings/whirled/Log.java b/src/java/com/threerings/whirled/Log.java index 0d6134ed9..f696727dd 100644 --- a/src/java/com/threerings/whirled/Log.java +++ b/src/java/com/threerings/whirled/Log.java @@ -1,5 +1,5 @@ // -// $Id: Log.java,v 1.1 2001/08/11 04:09:50 mdb Exp $ +// $Id: Log.java,v 1.2 2003/09/22 23:57:20 mdb Exp $ package com.threerings.whirled; @@ -12,6 +12,12 @@ public class Log public static com.samskivert.util.Log log = new com.samskivert.util.Log("whirled"); + /** Convenience function. */ + public static boolean debug () + { + return log.getLevel() == com.samskivert.util.Log.DEBUG; + } + /** Convenience function. */ public static void debug (String message) { diff --git a/src/java/com/threerings/whirled/server/SceneRegistry.java b/src/java/com/threerings/whirled/server/SceneRegistry.java index d57ece6c3..6d0f25f82 100644 --- a/src/java/com/threerings/whirled/server/SceneRegistry.java +++ b/src/java/com/threerings/whirled/server/SceneRegistry.java @@ -1,5 +1,5 @@ // -// $Id: SceneRegistry.java,v 1.18 2003/02/12 07:23:31 mdb Exp $ +// $Id: SceneRegistry.java,v 1.19 2003/09/22 23:57:20 mdb Exp $ package com.threerings.whirled.server; @@ -137,7 +137,9 @@ public class SceneRegistry return; } - Log.debug("Resolving scene [id=" + sceneId + "]."); + if (Log.debug()) { + Log.debug("Resolving scene [id=" + sceneId + "]."); + } // otherwise we've got to resolve the scene and call them back // later; we can manipulate the penders table with impunity here @@ -160,7 +162,9 @@ public class SceneRegistry // keywords... final int fsceneId = sceneId; - Log.debug("Invoking scene lookup [id=" + sceneId + "]."); + if (Log.debug()) { + Log.debug("Invoking scene lookup [id=" + sceneId + "]."); + } // then we queue up an execution unit that'll load the scene // and initialize it and all that @@ -262,8 +266,10 @@ public class SceneRegistry int sceneId = scmgr.getScene().getId(); _scenemgrs.put(sceneId, scmgr); - Log.debug("Registering scene manager [scid=" + sceneId + - ", scmgr=" + scmgr + "]."); + if (Log.debug()) { + Log.debug("Registering scene manager [scid=" + sceneId + + ", scmgr=" + scmgr + "]."); + } // now notify any penders ArrayList penders = (ArrayList)_penders.remove(sceneId); @@ -288,7 +294,10 @@ public class SceneRegistry if (_scenemgrs.remove(scmgr.getScene().getId()) == null) { Log.warning("Requested to unmap unmapped scene manager " + "[scmgr=" + scmgr + "]."); - } else { + return; + } + + if (Log.debug()) { Log.debug("Unmapped scene manager " + scmgr + "."); } }