diff --git a/src/java/com/threerings/NenyaLog.java b/src/java/com/threerings/NenyaLog.java index c65066bf..b6e21009 100644 --- a/src/java/com/threerings/NenyaLog.java +++ b/src/java/com/threerings/NenyaLog.java @@ -21,11 +21,10 @@ package com.threerings; -import java.util.logging.Logger; +import com.samskivert.util.Logger; /** - * A placeholder class that contains a reference to the log object used by this - * library. + * Contains a reference to the log object used by this library. */ public class NenyaLog { diff --git a/src/java/com/threerings/cast/CharacterManager.java b/src/java/com/threerings/cast/CharacterManager.java index 3850b279..e1b2d83b 100644 --- a/src/java/com/threerings/cast/CharacterManager.java +++ b/src/java/com/threerings/cast/CharacterManager.java @@ -39,7 +39,8 @@ import com.threerings.media.image.ImageManager; import com.threerings.util.DirectionCodes; import com.threerings.cast.CompositedActionFrames.ComponentFrames; -import com.threerings.cast.Log; + +import static com.threerings.cast.Log.log; /** * The character manager provides facilities for constructing sprites that @@ -67,7 +68,7 @@ public class CharacterManager // create a cache for our composited action frames int acsize = _cacheSize.getValue(); - Log.debug("Creating action cache [size=" + acsize + "k]."); + log.debug("Creating action cache [size=" + acsize + "k]."); _frameCache = new LRUHashMap(acsize*1024, new LRUHashMap.ItemSizer() { public int computeSize (Object value) { return (int)((CompositedMultiFrameImage) @@ -147,9 +148,7 @@ public class CharacterManager return sprite; } catch (Exception e) { - Log.warning("Failed to instantiate character sprite " + - "[e=" + e + "]."); - Log.logStackTrace(e); + log.warning("Failed to instantiate character sprite.", e); return null; } } @@ -181,7 +180,7 @@ public class CharacterManager if (!_cacheStatThrottle.throttleOp()) { long size = getEstimatedCacheMemoryUsage(); int[] eff = _frameCache.getTrackedEffectiveness(); - Log.debug("CharacterManager LRU [mem=" + (size / 1024) + "k" + + log.debug("CharacterManager LRU [mem=" + (size / 1024) + "k" + ", size=" + _frameCache.size() + ", hits=" + eff[0] + ", misses=" + eff[1] + "]."); } @@ -202,12 +201,12 @@ public class CharacterManager { try { if (getActionFrames(desc, action) == null) { - Log.warning("Failed to resolve action sequence " + + log.warning("Failed to resolve action sequence " + "[desc=" + desc + ", action=" + action + "]."); } } catch (NoSuchComponentException nsce) { - Log.warning("Failed to resolve action sequence " + + log.warning("Failed to resolve action sequence " + "[nsce=" + nsce + "]."); } } @@ -254,7 +253,7 @@ public class CharacterManager Colorization[][] zations = descrip.getColorizations(); Point[] xlations = descrip.getTranslations(); - Log.debug("Compositing action [action=" + action + + log.debug("Compositing action [action=" + action + ", descrip=" + descrip + "]."); // this will be used to construct any shadow layers @@ -337,7 +336,7 @@ public class CharacterManager { final ComponentClass cclass = _crepo.getComponentClass(sclass); if (cclass == null) { - Log.warning("Components reference non-existent shadow layer " + + log.warning("Components reference non-existent shadow layer " + "class [sclass=" + sclass + ", scomps=" + StringUtil.toString(scomps) + "]."); return null; diff --git a/src/java/com/threerings/cast/CharacterSprite.java b/src/java/com/threerings/cast/CharacterSprite.java index b159b271..0eca294b 100644 --- a/src/java/com/threerings/cast/CharacterSprite.java +++ b/src/java/com/threerings/cast/CharacterSprite.java @@ -28,6 +28,8 @@ import javax.swing.SwingUtilities; import com.threerings.media.sprite.ImageSprite; +import static com.threerings.cast.Log.log; + /** * A character sprite is a sprite that animates itself while walking * about in a scene. @@ -126,7 +128,7 @@ public class CharacterSprite extends ImageSprite { // sanity check if (action == null) { - Log.warning("Refusing to set null action sequence " + this + "."); + log.warning("Refusing to set null action sequence " + this + "."); Thread.dumpStack(); return; } @@ -143,7 +145,7 @@ public class CharacterSprite extends ImageSprite public void setOrientation (int orient) { if (orient < 0 || orient >= FINE_DIRECTION_COUNT) { - Log.info("Refusing to set invalid orientation [sprite=" + this + + log.info("Refusing to set invalid orientation [sprite=" + this + ", orient=" + orient + "]."); Thread.dumpStack(); return; @@ -257,13 +259,12 @@ public class CharacterSprite extends ImageSprite setFrameRate(actseq.framesPerSecond); } catch (NoSuchComponentException nsce) { - Log.warning("Character sprite references non-existent " + + log.warning("Character sprite references non-existent " + "component [sprite=" + this + ", err=" + nsce + "]."); } catch (Exception e) { - Log.warning("Failed to obtain action frames [sprite=" + this + - ", descrip=" + _descrip + ", action=" + _action + "]."); - Log.logStackTrace(e); + log.warning("Failed to obtain action frames [sprite=" + this + + ", descrip=" + _descrip + ", action=" + _action + "].", e); } } @@ -282,7 +283,7 @@ public class CharacterSprite extends ImageSprite { if (_descrip.getComponentIds() == null || _descrip.getComponentIds().length == 0) { - Log.warning("Invalid character descriptor [sprite=" + this + + log.warning("Invalid character descriptor [sprite=" + this + ", descrip=" + _descrip + "]."); Thread.dumpStack(); } @@ -316,7 +317,7 @@ public class CharacterSprite extends ImageSprite // we now need to update the render offset for this frame if (_aframes == null) { - Log.warning("Have no action frames! " + _aframes + "."); + log.warning("Have no action frames! " + _aframes + "."); } else { _oxoff = _aframes.getXOrigin(_orient, frameIdx); _oyoff = _aframes.getYOrigin(_orient, frameIdx); diff --git a/src/java/com/threerings/cast/Log.java b/src/java/com/threerings/cast/Log.java index 19de3a06..f3c24640 100644 --- a/src/java/com/threerings/cast/Log.java +++ b/src/java/com/threerings/cast/Log.java @@ -21,36 +21,12 @@ package com.threerings.cast; +import com.samskivert.util.Logger; + /** - * A placeholder class that contains a reference to the log object used by - * the cast package. + * Contains a reference to the log object used by the Cast package. */ public class Log { - public static com.samskivert.util.Log log = - new com.samskivert.util.Log("cast"); - - /** 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("cast"); } diff --git a/src/java/com/threerings/cast/builder/ComponentPanel.java b/src/java/com/threerings/cast/builder/ComponentPanel.java index fda4314e..1b3264df 100644 --- a/src/java/com/threerings/cast/builder/ComponentPanel.java +++ b/src/java/com/threerings/cast/builder/ComponentPanel.java @@ -27,9 +27,10 @@ import javax.swing.*; import com.samskivert.swing.VGroupLayout; -import com.threerings.cast.Log; import com.threerings.cast.*; +import static com.threerings.cast.Log.log; + /** * The component panel displays the available components for all * component classes and allows the user to choose a set of components @@ -66,7 +67,7 @@ public class ComponentPanel extends JPanel if (ccomps.size() > 0) { add(new ClassEditor(model, cclass, ccomps)); } else { - Log.info("Not creating editor for empty class " + + log.info("Not creating editor for empty class " + "[class=" + cclass + "]."); } } diff --git a/src/java/com/threerings/cast/bundle/BundleUtil.java b/src/java/com/threerings/cast/bundle/BundleUtil.java index 3d8ef106..88b40816 100644 --- a/src/java/com/threerings/cast/bundle/BundleUtil.java +++ b/src/java/com/threerings/cast/bundle/BundleUtil.java @@ -28,10 +28,11 @@ import java.io.ObjectInputStream; import com.samskivert.io.StreamUtil; -import com.threerings.cast.Log; import com.threerings.resource.FileResourceBundle; import com.threerings.resource.ResourceBundle; +import static com.threerings.cast.Log.log; + /** * Utility functions related to creating and manipulating component bundles. */ @@ -80,12 +81,12 @@ public class BundleUtil return new ObjectInputStream(bin).readObject(); } catch (InvalidClassException ice) { - Log.warning("Aiya! Serialized object is hosed [bundle=" + bundle + + log.warning("Aiya! Serialized object is hosed [bundle=" + bundle + ", element=" + path + ", error=" + ice.getMessage() + "]."); return null; } catch (IOException ioe) { - Log.warning("Error reading resource from bundle [bundle=" + bundle + ", path=" + path + + log.warning("Error reading resource from bundle [bundle=" + bundle + ", path=" + path + ", wiping?=" + wipeOnFailure + "]."); if (wipeOnFailure) { StreamUtil.close(bin); diff --git a/src/java/com/threerings/cast/bundle/BundledComponentRepository.java b/src/java/com/threerings/cast/bundle/BundledComponentRepository.java index 9d098937..47ad0c9e 100644 --- a/src/java/com/threerings/cast/bundle/BundledComponentRepository.java +++ b/src/java/com/threerings/cast/bundle/BundledComponentRepository.java @@ -60,11 +60,12 @@ import com.threerings.cast.CharacterComponent; import com.threerings.cast.ComponentClass; import com.threerings.cast.ComponentRepository; import com.threerings.cast.FrameProvider; -import com.threerings.cast.Log; import com.threerings.cast.NoSuchComponentException; import com.threerings.cast.StandardActions; import com.threerings.cast.TrimmedMultiFrameImage; +import static com.threerings.cast.Log.log; + /** * A component repository implementation that obtains information from resource bundles. * @@ -227,7 +228,7 @@ public class BundledComponentRepository // look up the component class information ComponentClass clazz = (ComponentClass)_classes.get(cclass); if (clazz == null) { - Log.warning("Non-existent component class [class=" + cclass + ", name=" + cname + + log.warning("Non-existent component class [class=" + cclass + ", name=" + cname + ", id=" + componentId + "]."); return; } @@ -247,7 +248,7 @@ public class BundledComponentRepository if (!comps.contains(component)) { comps.add(component); } else { - Log.info("Requested to register the same component twice? [comp=" + component + "]."); + log.info("Requested to register the same component twice? [comp=" + component + "]."); } } @@ -286,7 +287,7 @@ public class BundledComponentRepository // obtain the action sequence definition for this action ActionSequence actseq = (ActionSequence)_actions.get(action); if (actseq == null) { - Log.warning("Missing action sequence definition [action=" + action + + log.warning("Missing action sequence definition [action=" + action + ", component=" + component + "]."); return null; } @@ -330,7 +331,7 @@ public class BundledComponentRepository // if this is a shadow or crop image, no need to freak out as they are optional if (!StandardActions.CROP_TYPE.equals(type) && !StandardActions.SHADOW_TYPE.equals(type)) { - Log.warning("Unable to locate tileset for action '" + imgpath + "' " + + log.warning("Unable to locate tileset for action '" + imgpath + "' " + component + "."); if (_wipeOnFailure && _bundle instanceof FileResourceBundle) { ((FileResourceBundle)_bundle).wipeBundle(false); @@ -344,8 +345,7 @@ public class BundledComponentRepository return new TileSetFrameImage(aset, actseq); } catch (Exception e) { - Log.warning("Error loading tset for action '" + imgpath + "' " + component + "."); - Log.logStackTrace(e); + log.warning("Error loading tset for action '" + imgpath + "' " + component + ".", e); return null; } } diff --git a/src/java/com/threerings/cast/util/CastUtil.java b/src/java/com/threerings/cast/util/CastUtil.java index b64f376c..cfa41666 100644 --- a/src/java/com/threerings/cast/util/CastUtil.java +++ b/src/java/com/threerings/cast/util/CastUtil.java @@ -30,7 +30,8 @@ import com.samskivert.util.RandomUtil; import com.threerings.cast.CharacterDescriptor; import com.threerings.cast.ComponentClass; import com.threerings.cast.ComponentRepository; -import com.threerings.cast.Log; + +import static com.threerings.cast.Log.log; /** * Miscellaneous cast utility routines. @@ -52,7 +53,7 @@ public class CastUtil // make sure the component class exists if (cclass == null) { - Log.warning("Missing definition for component class " + + log.warning("Missing definition for component class " + "[class=" + cname + "]."); continue; } @@ -60,7 +61,7 @@ public class CastUtil // make sure there are some components in this class Iterator iter = crepo.enumerateComponentIds(cclass); if (!iter.hasNext()) { - Log.info("Skipping class for which we have no components " + + log.info("Skipping class for which we have no components " + "[class=" + cclass + "]."); continue; } @@ -84,7 +85,7 @@ public class CastUtil int idx = RandomUtil.getInt(choices.size()); components[ii] = ((Integer)choices.get(idx)).intValue(); } else { - Log.info("Have no components in class [class=" + cclass + "]."); + log.info("Have no components in class [class=" + cclass + "]."); } } diff --git a/src/java/com/threerings/geom/GeomUtil.java b/src/java/com/threerings/geom/GeomUtil.java index b2023f1b..0c0648c4 100644 --- a/src/java/com/threerings/geom/GeomUtil.java +++ b/src/java/com/threerings/geom/GeomUtil.java @@ -25,6 +25,8 @@ import java.awt.Point; import java.awt.Rectangle; import java.awt.geom.Point2D; +import static com.threerings.geom.Log.log; + /** * General geometry utilites. */ @@ -200,7 +202,7 @@ public class GeomUtil public static Rectangle grow (Rectangle source, Rectangle target) { if (target == null) { - Log.warning("Can't grow with null rectangle [src=" + source + ", tgt=" + target + "]."); + log.warning("Can't grow with null rectangle [src=" + source + ", tgt=" + target + "]."); Thread.dumpStack(); } else if (source == null) { source = new Rectangle(target); diff --git a/src/java/com/threerings/geom/Log.java b/src/java/com/threerings/geom/Log.java index 4e8b93a9..d2b91f8d 100644 --- a/src/java/com/threerings/geom/Log.java +++ b/src/java/com/threerings/geom/Log.java @@ -21,43 +21,12 @@ package com.threerings.geom; +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 final String PACKAGE = "geom"; - - public static com.samskivert.util.Log log = - new com.samskivert.util.Log(PACKAGE); - - /** 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 int getLevel () - { - return com.samskivert.util.Log.getLevel(PACKAGE); - } + public static Logger log = Logger.getLogger("com.threerings.geom"); } diff --git a/src/java/com/threerings/jme/JmeApp.java b/src/java/com/threerings/jme/JmeApp.java index aaf5fc2c..ffb204b5 100644 --- a/src/java/com/threerings/jme/JmeApp.java +++ b/src/java/com/threerings/jme/JmeApp.java @@ -56,6 +56,8 @@ import com.jme.util.Timer; import com.threerings.jme.camera.CameraHandler; +import static com.threerings.jme.Log.log; + /** * Defines a basic application framework providing integration with the * Presents networking system and @@ -217,7 +219,7 @@ public class JmeApp _failures = 0; } catch (Throwable t) { - Log.logStackTrace(t); + log.warning(t); // stick a fork in things if we fail too many times in a row if (++_failures > MAX_SUCCESSIVE_FAILURES) { stop(); @@ -231,7 +233,7 @@ public class JmeApp try { cleanup(); } catch (Throwable t) { - Log.logStackTrace(t); + log.warning(t); } finally { exit(); } @@ -281,7 +283,7 @@ public class JmeApp try { Thread.sleep(5); } catch (InterruptedException e) { - Log.warning("Error waiting for dialog system, " + + log.warning("Error waiting for dialog system, " + "using defaults."); } } @@ -427,7 +429,7 @@ public class JmeApp */ protected void reportInitFailure (Throwable t) { - Log.logStackTrace(t); + log.warning(t); } /** diff --git a/src/java/com/threerings/jme/JmeCanvasApp.java b/src/java/com/threerings/jme/JmeCanvasApp.java index 22424d8e..e41f2837 100644 --- a/src/java/com/threerings/jme/JmeCanvasApp.java +++ b/src/java/com/threerings/jme/JmeCanvasApp.java @@ -40,6 +40,8 @@ import com.jmex.awt.lwjgl.LWJGLCanvas; import com.jmex.bui.CanvasRootNode; +import static com.threerings.jme.Log.log; + /** * Extends the basic {@link JmeApp} with the necessary wiring to use the * GL/AWT bridge to display our GL interface in an AWT component. @@ -56,7 +58,7 @@ public class JmeCanvasApp extends JmeApp try { _canvas = createCanvas(); } catch (LWJGLException e) { - Log.warning("Failed to create LWJGL canvas [error=" + e + "]."); + log.warning("Failed to create LWJGL canvas [error=" + e + "]."); } ((JMECanvas)_canvas).setImplementor(_winimp); _canvas.setBounds(0, 0, width, height); @@ -124,7 +126,7 @@ public class JmeCanvasApp extends JmeApp try { makeCurrent(); } catch (LWJGLException e) { - Log.warning("Failed to make context current [error=" + + log.warning("Failed to make context current [error=" + e + "]."); } } @@ -167,7 +169,7 @@ public class JmeCanvasApp extends JmeApp DisplaySystem.updateStates(renderer); if (!init()) { - Log.warning("JmeCanvasApp init failed."); + log.warning("JmeCanvasApp init failed."); } } @@ -181,7 +183,7 @@ public class JmeCanvasApp extends JmeApp // we don't process events as the AWT queue handles them _failures = 0; } catch (Throwable t) { - Log.logStackTrace(t); + log.warning(t); // stick a fork in things if we fail too many // times in a row if (++_failures > MAX_SUCCESSIVE_FAILURES) { diff --git a/src/java/com/threerings/jme/Log.java b/src/java/com/threerings/jme/Log.java index 3bef4861..8c6d102b 100644 --- a/src/java/com/threerings/jme/Log.java +++ b/src/java/com/threerings/jme/Log.java @@ -21,38 +21,13 @@ package com.threerings.jme; -import java.util.logging.Level; -import java.util.logging.Logger; +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 { /** We dispatch our log messages through this logger. */ public static Logger log = Logger.getLogger("com.threerings.nenya.jme"); - - /** 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); - } } diff --git a/src/java/com/threerings/jme/camera/GodViewHandler.java b/src/java/com/threerings/jme/camera/GodViewHandler.java index 4bedd358..73929042 100644 --- a/src/java/com/threerings/jme/camera/GodViewHandler.java +++ b/src/java/com/threerings/jme/camera/GodViewHandler.java @@ -34,7 +34,8 @@ import com.jme.input.action.*; import com.jme.input.action.InputActionEvent; import com.threerings.jme.JmeApp; -import com.threerings.jme.Log; + +import static com.threerings.jme.Log.log; /** * Sets up camera controls for moving around from a top-down perspective, diff --git a/src/java/com/threerings/jme/camera/SplinePath.java b/src/java/com/threerings/jme/camera/SplinePath.java index f0742253..2a21c7e2 100644 --- a/src/java/com/threerings/jme/camera/SplinePath.java +++ b/src/java/com/threerings/jme/camera/SplinePath.java @@ -24,7 +24,7 @@ package com.threerings.jme.camera; import com.jme.math.Vector3f; import com.jme.renderer.Camera; -import com.threerings.jme.Log; +import static com.threerings.jme.Log.log; /** * Moves the camera along a cubic Hermite spline path defined by the start and diff --git a/src/java/com/threerings/jme/camera/SwingPath.java b/src/java/com/threerings/jme/camera/SwingPath.java index 6b753998..9dd018f2 100644 --- a/src/java/com/threerings/jme/camera/SwingPath.java +++ b/src/java/com/threerings/jme/camera/SwingPath.java @@ -26,7 +26,7 @@ import com.jme.math.Quaternion; import com.jme.math.Vector3f; import com.jme.renderer.Camera; -import com.threerings.jme.Log; +import static com.threerings.jme.Log.log; /** * Swings the camera around a point of interest (which should be somewhere @@ -78,13 +78,13 @@ public class SwingPath extends CameraPath super(camhand); if (pangle == 0) { - Log.warning("Requested to swing camera through zero degrees " + + log.warning("Requested to swing camera through zero degrees " + "[spot=" + spot + ", paxis=" + paxis + ", angvel=" + angvel + ", zoom=" + zoom + "]."); pangle = 0.0001f; } if (angvel <= 0) { - Log.warning("Requested to swing camera with invalid velocity " + + log.warning("Requested to swing camera with invalid velocity " + "[spot=" + spot + ", paxis=" + paxis + ", pangle=" + pangle + ", angvel=" + angvel + ", zoom=" + zoom + "]."); diff --git a/src/java/com/threerings/jme/chat/ChatView.java b/src/java/com/threerings/jme/chat/ChatView.java index 0990c287..63408044 100644 --- a/src/java/com/threerings/jme/chat/ChatView.java +++ b/src/java/com/threerings/jme/chat/ChatView.java @@ -46,7 +46,8 @@ import com.threerings.crowd.chat.data.UserMessage; import com.threerings.crowd.data.PlaceObject; import com.threerings.jme.JmeContext; -import com.threerings.jme.Log; + +import static com.threerings.jme.Log.log; /** * Displays chat messages and allows for their input. @@ -140,7 +141,7 @@ public class ChatView extends BContainer return true; } else { - Log.warning("Received unknown message type: " + msg + "."); + log.warning("Received unknown message type: " + msg + "."); return false; } } diff --git a/src/java/com/threerings/jme/model/Model.java b/src/java/com/threerings/jme/model/Model.java index 312d6e82..7be8e943 100644 --- a/src/java/com/threerings/jme/model/Model.java +++ b/src/java/com/threerings/jme/model/Model.java @@ -61,9 +61,10 @@ import com.samskivert.util.PropertiesUtil; import com.samskivert.util.RandomUtil; import com.samskivert.util.StringUtil; -import com.threerings.jme.Log; import com.threerings.jme.util.SpatialVisitor; +import static com.threerings.jme.Log.log; + /** * The base node for models. */ @@ -594,7 +595,7 @@ public class Model extends ModelNode return anim; } } - Log.warning("Requested unknown animation [name=" + name + "]."); + log.warning("Requested unknown animation [name=" + name + "]."); return null; } diff --git a/src/java/com/threerings/jme/model/ModelMesh.java b/src/java/com/threerings/jme/model/ModelMesh.java index 2b461d95..4bc43401 100644 --- a/src/java/com/threerings/jme/model/ModelMesh.java +++ b/src/java/com/threerings/jme/model/ModelMesh.java @@ -66,9 +66,10 @@ import com.jme.util.geom.BufferUtils; import com.samskivert.util.PropertiesUtil; import com.samskivert.util.StringUtil; -import com.threerings.jme.Log; import com.threerings.jme.util.ShaderCache; +import static com.threerings.jme.Log.log; + /** * A {@link TriMesh} with a serialization mechanism tailored to stored models. */ diff --git a/src/java/com/threerings/jme/model/ModelNode.java b/src/java/com/threerings/jme/model/ModelNode.java index ce96da7f..12362341 100644 --- a/src/java/com/threerings/jme/model/ModelNode.java +++ b/src/java/com/threerings/jme/model/ModelNode.java @@ -40,10 +40,11 @@ import com.jme.util.export.JMEImporter; import com.jme.util.export.InputCapsule; import com.jme.util.export.OutputCapsule; -import com.threerings.jme.Log; import com.threerings.jme.util.JmeUtil; import com.threerings.jme.util.ShaderCache; +import static com.threerings.jme.Log.log; + /** * A {@link Node} with a serialization mechanism tailored to stored models. */ diff --git a/src/java/com/threerings/jme/model/Rotator.java b/src/java/com/threerings/jme/model/Rotator.java index 440587b6..d530d623 100644 --- a/src/java/com/threerings/jme/model/Rotator.java +++ b/src/java/com/threerings/jme/model/Rotator.java @@ -36,9 +36,10 @@ import com.jme.util.export.OutputCapsule; import com.samskivert.util.StringUtil; -import com.threerings.jme.Log; import com.threerings.jme.util.JmeUtil; +import static com.threerings.jme.Log.log; + /** * A procedural animation that rotates a node around at a constant angular * velocity. diff --git a/src/java/com/threerings/jme/model/SkinMesh.java b/src/java/com/threerings/jme/model/SkinMesh.java index 30ea563c..73b50193 100644 --- a/src/java/com/threerings/jme/model/SkinMesh.java +++ b/src/java/com/threerings/jme/model/SkinMesh.java @@ -60,11 +60,12 @@ import com.samskivert.util.ArrayUtil; import com.samskivert.util.HashIntMap; import com.samskivert.util.ListUtil; -import com.threerings.jme.Log; import com.threerings.jme.util.JmeUtil; import com.threerings.jme.util.ShaderCache; import com.threerings.jme.util.ShaderConfig; +import static com.threerings.jme.Log.log; + /** * A triangle mesh that deforms according to a bone hierarchy. */ diff --git a/src/java/com/threerings/jme/model/TextureAnimator.java b/src/java/com/threerings/jme/model/TextureAnimator.java index 53c66406..ea699116 100644 --- a/src/java/com/threerings/jme/model/TextureAnimator.java +++ b/src/java/com/threerings/jme/model/TextureAnimator.java @@ -37,11 +37,12 @@ import com.jme.util.export.OutputCapsule; import com.samskivert.util.StringUtil; -import com.threerings.jme.Log; import com.threerings.jme.util.JmeUtil; import com.threerings.jme.util.JmeUtil.FrameState; import com.threerings.jme.util.SpatialVisitor; +import static com.threerings.jme.Log.log; + /** * Animates a model's textures by flipping between different parts. */ diff --git a/src/java/com/threerings/jme/model/TextureTranslator.java b/src/java/com/threerings/jme/model/TextureTranslator.java index 15194c4d..bef1d4b5 100644 --- a/src/java/com/threerings/jme/model/TextureTranslator.java +++ b/src/java/com/threerings/jme/model/TextureTranslator.java @@ -37,9 +37,10 @@ import com.jme.util.export.OutputCapsule; import com.samskivert.util.StringUtil; -import com.threerings.jme.Log; import com.threerings.jme.util.SpatialVisitor; +import static com.threerings.jme.Log.log; + /** * A procedural animation that translates the model's textures at a constant velocity. */ @@ -54,7 +55,7 @@ public class TextureTranslator extends TextureController if (vel != null && vel.length == 2) { _velocity = new Vector2f(vel[0], vel[1]); } else { - Log.warning("Invalid velocity [velocity=" + velstr + "]."); + log.warning("Invalid velocity [velocity=" + velstr + "]."); } } diff --git a/src/java/com/threerings/jme/model/Translator.java b/src/java/com/threerings/jme/model/Translator.java index 5c26cea5..ec40cae8 100644 --- a/src/java/com/threerings/jme/model/Translator.java +++ b/src/java/com/threerings/jme/model/Translator.java @@ -36,9 +36,10 @@ import com.jme.util.export.OutputCapsule; import com.samskivert.util.StringUtil; -import com.threerings.jme.Log; import com.threerings.jme.util.JmeUtil; +import static com.threerings.jme.Log.log; + /** * A procedural animation that moves a node along a straight line at a constant velocity (then * either repeats or moves it in the other direction). diff --git a/src/java/com/threerings/jme/sprite/Sprite.java b/src/java/com/threerings/jme/sprite/Sprite.java index 008174c8..793cdf89 100644 --- a/src/java/com/threerings/jme/sprite/Sprite.java +++ b/src/java/com/threerings/jme/sprite/Sprite.java @@ -26,7 +26,7 @@ import com.jme.scene.Spatial; import com.samskivert.util.ObserverList; -import com.threerings.jme.Log; +import static com.threerings.jme.Log.log; /** * Represents a visual entity that one controls as a single unit. Sprites @@ -161,7 +161,7 @@ public class Sprite extends Node public void pathCompleted () { if (_path == null) { - Log.warning("pathCompleted() called on pathless sprite " + + log.warning("pathCompleted() called on pathless sprite " + "(re-completed?) [sprite=" + this + "]."); Thread.dumpStack(); return; diff --git a/src/java/com/threerings/jme/tile/FringeConfiguration.java b/src/java/com/threerings/jme/tile/FringeConfiguration.java index a7dcba11..ac2734f8 100644 --- a/src/java/com/threerings/jme/tile/FringeConfiguration.java +++ b/src/java/com/threerings/jme/tile/FringeConfiguration.java @@ -27,7 +27,7 @@ import java.util.HashMap; import com.samskivert.util.StringUtil; -import com.threerings.jme.Log; +import static com.threerings.jme.Log.log; /** * Used to manage data about which tiles fringe on which others and how @@ -54,7 +54,7 @@ public class FringeConfiguration implements Serializable if (record.isValid()) { fringes.add(record); } else { - Log.warning("Not adding invalid fringe record [tile=" + this + + log.warning("Not adding invalid fringe record [tile=" + this + ", fringe=" + record + "]."); } } @@ -112,7 +112,7 @@ public class FringeConfiguration implements Serializable if (record.isValid()) { _trecs.put(record.type, record); } else { - Log.warning("Refusing to add invalid tile record " + + log.warning("Refusing to add invalid tile record " + "[tile=" + record + "]."); } } diff --git a/src/java/com/threerings/jme/tile/TileFringer.java b/src/java/com/threerings/jme/tile/TileFringer.java index 6c3d10bc..ed9c6527 100644 --- a/src/java/com/threerings/jme/tile/TileFringer.java +++ b/src/java/com/threerings/jme/tile/TileFringer.java @@ -32,7 +32,7 @@ import com.samskivert.util.QuickSort; import com.threerings.media.image.ImageUtil; import com.threerings.media.tile.TileUtil; -import com.threerings.jme.Log; +import static com.threerings.jme.Log.log; /** * Computes fringe tile images according to the rules in an associated @@ -148,7 +148,7 @@ public class TileFringer BufferedImage source = _isrc.getTileSource(baseType); if (source == null) { - Log.warning("Missing source tile [type=" + baseType + "]."); + log.warning("Missing source tile [type=" + baseType + "]."); return null; } @@ -187,7 +187,7 @@ public class TileFringer BufferedImage fsimg = (frec == null) ? null : _isrc.getFringeSource(frec.name); if (fsimg == null) { - Log.warning("Missing fringe source image [type=" + fringerType + + log.warning("Missing fringe source image [type=" + fringerType + ", hash=" + hashValue + ", frec=" + frec + "]."); return; } diff --git a/src/java/com/threerings/jme/tile/tools/xml/FringeConfigurationParser.java b/src/java/com/threerings/jme/tile/tools/xml/FringeConfigurationParser.java index c7b1fe96..cbf991c4 100644 --- a/src/java/com/threerings/jme/tile/tools/xml/FringeConfigurationParser.java +++ b/src/java/com/threerings/jme/tile/tools/xml/FringeConfigurationParser.java @@ -30,11 +30,12 @@ import com.samskivert.xml.SetPropertyFieldsRule; import com.threerings.tools.xml.CompiledConfigParser; -import com.threerings.jme.Log; import com.threerings.jme.tile.FringeConfiguration.TileRecord; import com.threerings.jme.tile.FringeConfiguration.FringeRecord; import com.threerings.jme.tile.FringeConfiguration; +import static com.threerings.jme.Log.log; + /** * Parses fringe config definitions, which look like so (with angle * brackets instead of square): diff --git a/src/java/com/threerings/jme/tools/AnimationDef.java b/src/java/com/threerings/jme/tools/AnimationDef.java index 70f40cfb..3e053572 100644 --- a/src/java/com/threerings/jme/tools/AnimationDef.java +++ b/src/java/com/threerings/jme/tools/AnimationDef.java @@ -36,12 +36,13 @@ import com.jme.scene.Spatial; import com.samskivert.util.Tuple; -import com.threerings.jme.Log; import com.threerings.jme.model.Model; import com.threerings.jme.util.JmeUtil; import com.threerings.jme.tools.ModelDef.TransformNode; +import static com.threerings.jme.Log.log; + /** * A basic representation for keyframe animations. */ diff --git a/src/java/com/threerings/jme/tools/ModelDef.java b/src/java/com/threerings/jme/tools/ModelDef.java index 88e92034..e8197386 100644 --- a/src/java/com/threerings/jme/tools/ModelDef.java +++ b/src/java/com/threerings/jme/tools/ModelDef.java @@ -53,7 +53,6 @@ import com.samskivert.util.PropertiesUtil; import com.samskivert.util.StringUtil; import com.samskivert.util.Tuple; -import com.threerings.jme.Log; import com.threerings.jme.model.Model; import com.threerings.jme.model.ModelController; import com.threerings.jme.model.ModelMesh; @@ -62,6 +61,8 @@ import com.threerings.jme.model.SkinMesh; import com.threerings.jme.util.JmeUtil; import com.threerings.jme.util.SpatialVisitor; +import static com.threerings.jme.Log.log; + /** * An intermediate representation for models used to store data parsed from * XML and convert it into JME nodes. @@ -130,7 +131,7 @@ public class ModelDef ((ModelNode)pnode).attachChild(_spatial); } else if (parent != null) { - Log.warning("Missing or invalid parent node [spatial=" + + log.warning("Missing or invalid parent node [spatial=" + name + ", parent=" + parent + "]."); } } @@ -626,7 +627,7 @@ public class ModelDef if (node instanceof ModelNode) { bones.add((ModelNode)node); } else { - Log.warning("Missing or invalid bone for bone weight " + + log.warning("Missing or invalid bone for bone weight " + "[bone=" + bone + "]."); } } @@ -883,7 +884,7 @@ public class ModelDef Spatial target = node.equals(model.getName()) ? model : nodes.get(node); if (target == null) { - Log.warning("Missing controller node [name=" + node + "]."); + log.warning("Missing controller node [name=" + node + "]."); continue; } ModelController ctrl = createController(subProps, target); @@ -912,7 +913,7 @@ public class ModelDef try { ctrl = (ModelController)Class.forName(cname).newInstance(); } catch (Exception e) { - Log.warning("Error instantiating controller [class=" + cname + + log.warning("Error instantiating controller [class=" + cname + ", error=" + e + "]."); return null; } diff --git a/src/java/com/threerings/jme/tools/ModelViewer.java b/src/java/com/threerings/jme/tools/ModelViewer.java index 4531f688..03fc0364 100644 --- a/src/java/com/threerings/jme/tools/ModelViewer.java +++ b/src/java/com/threerings/jme/tools/ModelViewer.java @@ -110,13 +110,14 @@ import com.threerings.util.MessageBundle; import com.threerings.util.MessageManager; import com.threerings.jme.JmeCanvasApp; -import com.threerings.jme.Log; import com.threerings.jme.camera.CameraHandler; import com.threerings.jme.model.Model; import com.threerings.jme.model.TextureProvider; import com.threerings.jme.util.ShaderCache; import com.threerings.jme.util.SpatialVisitor; +import static com.threerings.jme.Log.log; + /** * A simple viewer application that allows users to examine models and their animations by loading * them from their uncompiled .properties / .mxml representations or @@ -136,7 +137,7 @@ public class ModelViewer extends JmeCanvasApp System.setErr(logOut); } catch (IOException ioe) { - Log.warning("Failed to open debug log [path=" + dlog + + log.warning("Failed to open debug log [path=" + dlog + ", error=" + ioe + "]."); } } @@ -731,7 +732,7 @@ public class ModelViewer extends JmeCanvasApp Texture tex = TextureManager.loadTexture(file.toString(), Texture.MM_LINEAR_LINEAR, Texture.FM_LINEAR); if (tex == null) { - Log.warning("Couldn't find texture [path=" + file + + log.warning("Couldn't find texture [path=" + file + "]."); return null; } diff --git a/src/java/com/threerings/jme/util/ImageCache.java b/src/java/com/threerings/jme/util/ImageCache.java index f3693fff..34e6872c 100644 --- a/src/java/com/threerings/jme/util/ImageCache.java +++ b/src/java/com/threerings/jme/util/ImageCache.java @@ -230,7 +230,7 @@ public class ImageCache try { bufimg = _rsrcmgr.getImageResource(rsrcPath); } catch (Throwable t) { - log.log(Level.WARNING, "Unable to load image resource " + + log.warning("Unable to load image resource " + "[path=" + rsrcPath + "].", t); // cope; return an error image of abitrary size bufimg = ImageUtil.createErrorImage(64, 64); @@ -280,7 +280,7 @@ public class ImageCache if (returnNull) { return null; } - log.log(Level.WARNING, "Unable to load image resource [path=" + rsrcPath + "].", t); + log.warning("Unable to load image resource [path=" + rsrcPath + "].", t); // cope; return an error image of abitrary size bufimg = ImageUtil.createErrorImage(64, 64); } @@ -324,7 +324,7 @@ public class ImageCache if (returnNull) { return null; } - log.log(Level.WARNING, "Unable to load image resource [path=" + rsrcPath + "].", t); + log.warning("Unable to load image resource [path=" + rsrcPath + "].", t); // cope; return an error image of abitrary size silimg = ImageUtil.createErrorImage(64, 64); } @@ -362,7 +362,7 @@ public class ImageCache try { image = _rsrcmgr.getImageResource(rsrcPath); } catch (Throwable t) { - log.log(Level.WARNING, "Unable to load image resource [path=" + rsrcPath + "].", t); + log.warning("Unable to load image resource [path=" + rsrcPath + "].", t); // cope; return an error image of abitrary size image = ImageUtil.createErrorImage(64, 64); } diff --git a/src/java/com/threerings/jme/util/JmeUtil.java b/src/java/com/threerings/jme/util/JmeUtil.java index 52881527..81cec484 100644 --- a/src/java/com/threerings/jme/util/JmeUtil.java +++ b/src/java/com/threerings/jme/util/JmeUtil.java @@ -28,7 +28,7 @@ import com.jme.scene.Controller; import com.samskivert.util.StringUtil; -import com.threerings.jme.Log; +import static com.threerings.jme.Log.log; /** * Some static classes and methods of general utility to applications using JME. @@ -159,7 +159,7 @@ public class JmeUtil if (vals != null && vals.length == 3) { return new Vector3f(vals[0], vals[1], vals[2]); } else { - Log.warning("Invalid vector [vector=" + vector + "]."); + log.warning("Invalid vector [vector=" + vector + "]."); } } return null; @@ -179,7 +179,7 @@ public class JmeUtil } else if ("wrap".equals(type)) { return Controller.RT_WRAP; } else if (type != null) { - Log.warning("Invalid repeat type [type=" + type + "]."); + log.warning("Invalid repeat type [type=" + type + "]."); } return defaultType; } diff --git a/src/java/com/threerings/media/AbstractMedia.java b/src/java/com/threerings/media/AbstractMedia.java index 22c38de5..29a59daf 100644 --- a/src/java/com/threerings/media/AbstractMedia.java +++ b/src/java/com/threerings/media/AbstractMedia.java @@ -33,6 +33,8 @@ import java.awt.geom.Rectangle2D; import com.samskivert.util.ObserverList; import com.samskivert.util.StringUtil; +import static com.threerings.media.Log.log; + /** * Something that can be rendered on the media panel. */ @@ -216,7 +218,7 @@ public abstract class AbstractMedia if (_mgr != null) { _mgr.queueNotification(_observers, amop); } else { - Log.warning("Have no manager, dropping notification " + + log.warning("Have no manager, dropping notification " + "[media=" + this + ", op=" + amop + "]."); } } diff --git a/src/java/com/threerings/media/AbstractMediaManager.java b/src/java/com/threerings/media/AbstractMediaManager.java index 1c8ddd04..f696787a 100644 --- a/src/java/com/threerings/media/AbstractMediaManager.java +++ b/src/java/com/threerings/media/AbstractMediaManager.java @@ -32,6 +32,8 @@ import com.samskivert.util.ObserverList.ObserverOp; import com.samskivert.util.ObserverList; import com.samskivert.util.Tuple; +import static com.threerings.resource.Log.log; + /** * Manages, ticks, and paints {@link AbstractMedia}. */ @@ -109,8 +111,7 @@ public abstract class AbstractMediaManager } } catch (Exception e) { - Log.warning("Failed to render media [media=" + media + ", e=" + e + "]."); - Log.logStackTrace(e); + log.warning("Failed to render media [media=" + media + "].", e); } } } @@ -124,7 +125,7 @@ public abstract class AbstractMediaManager public void fastForward (long timeDelta) { if (_tickStamp > 0) { - Log.warning("Egads! Asked to fastForward() during a tick."); + log.warning("Egads! Asked to fastForward() during a tick."); Thread.dumpStack(); } @@ -161,7 +162,7 @@ public abstract class AbstractMediaManager public void renderOrderDidChange (AbstractMedia media) { if (_tickStamp > 0) { - Log.warning("Egads! Render order changed during a tick."); + log.warning("Egads! Render order changed during a tick."); Thread.dumpStack(); } @@ -189,7 +190,7 @@ public abstract class AbstractMediaManager protected boolean insertMedia (AbstractMedia media) { if (_media.contains(media)) { - Log.warning("Attempt to insert media more than once [media=" + media + "]."); + log.warning("Attempt to insert media more than once [media=" + media + "]."); Thread.dumpStack(); return false; } @@ -241,7 +242,7 @@ public abstract class AbstractMediaManager } return true; } - Log.warning("Attempt to remove media that wasn't inserted [media=" + media + "]."); + log.warning("Attempt to remove media that wasn't inserted [media=" + media + "]."); return false; } @@ -252,7 +253,7 @@ public abstract class AbstractMediaManager protected void clearMedia () { if (_tickStamp > 0) { - Log.warning("Egads! Requested to clearMedia() during a tick."); + log.warning("Egads! Requested to clearMedia() during a tick."); Thread.dumpStack(); } diff --git a/src/java/com/threerings/media/ActiveRepaintManager.java b/src/java/com/threerings/media/ActiveRepaintManager.java index 77416a86..ed95d262 100644 --- a/src/java/com/threerings/media/ActiveRepaintManager.java +++ b/src/java/com/threerings/media/ActiveRepaintManager.java @@ -47,6 +47,8 @@ import com.samskivert.util.ListUtil; import com.samskivert.util.RunAnywhere; import com.samskivert.util.StringUtil; +import static com.threerings.media.Log.log; + /** * Used to get Swing's repainting to jive with our active rendering strategy. * @@ -70,7 +72,7 @@ public class ActiveRepaintManager extends RepaintManager { Component vroot = null; if (DEBUG) { - Log.info("Maybe invalidating " + toString(comp) + "."); + log.info("Maybe invalidating " + toString(comp) + "."); } // locate the validation root for this component @@ -101,7 +103,7 @@ public class ActiveRepaintManager extends RepaintManager // widget hierarchy if (vroot == null) { if (DEBUG) { - Log.info("Skipping vrootless component: " + toString(comp)); + log.info("Skipping vrootless component: " + toString(comp)); } return; } @@ -110,7 +112,7 @@ public class ActiveRepaintManager extends RepaintManager // that is showing if (getRoot(vroot) == null) { if (DEBUG) { - Log.info("Skipping rootless component [comp=" + toString(comp) + + log.info("Skipping rootless component [comp=" + toString(comp) + ", vroot=" + toString(vroot) + "]."); } return; @@ -119,7 +121,7 @@ public class ActiveRepaintManager extends RepaintManager // add the invalid component to our list and we'll validate it on the next frame if (!ListUtil.containsRef(_invalid, vroot)) { if (DEBUG) { - Log.info("Invalidating " + toString(vroot) + "."); + log.info("Invalidating " + toString(vroot) + "."); } _invalid = ListUtil.add(_invalid, vroot); } @@ -151,7 +153,7 @@ public class ActiveRepaintManager extends RepaintManager } if (DEBUG) { - Log.info("Dirtying component [comp=" + toString(comp) + + log.info("Dirtying component [comp=" + toString(comp) + ", drect=" + StringUtil.toString(new Rectangle(x, y, width, height)) + "]."); } @@ -221,7 +223,7 @@ public class ActiveRepaintManager extends RepaintManager for (int ii = 0; ii < icount; ii++) { if (invalid[ii] != null) { if (DEBUG) { - Log.info("Validating " + invalid[ii]); + log.info("Validating " + invalid[ii]); } ((Component)invalid[ii]).validate(); } @@ -275,7 +277,7 @@ public class ActiveRepaintManager extends RepaintManager drect.y = y; if (DEBUG) { - Log.info("Found dirty parent [comp=" + toString(comp) + + log.info("Found dirty parent [comp=" + toString(comp) + ", drect=" + StringUtil.toString(drect) + ", pcomp=" + toString(c) + ", prect=" + StringUtil.toString(prect) + "]."); @@ -283,7 +285,7 @@ public class ActiveRepaintManager extends RepaintManager prect.add(drect); if (DEBUG) { - Log.info("New prect " + StringUtil.toString(prect)); + log.info("New prect " + StringUtil.toString(prect)); } // remove the child component and be on our way @@ -361,7 +363,7 @@ public class ActiveRepaintManager extends RepaintManager // instance if (root == _root) { if (DEBUG) { - Log.info("Repainting [comp=" + toString(comp) + StringUtil.toString(_cbounds) + + log.info("Repainting [comp=" + toString(comp) + StringUtil.toString(_cbounds) + ", ocomp=" + toString(ocomp) + ", drect=" + StringUtil.toString(drect) + "]."); } @@ -374,8 +376,7 @@ public class ActiveRepaintManager extends RepaintManager ocomp.paint(g); } catch (Exception e) { - Log.warning("Exception while painting component [comp=" + ocomp + "]."); - Log.logStackTrace(e); + log.warning("Exception while painting component [comp=" + ocomp + "].", e); } g.translate(-_cbounds.x, -_cbounds.y); @@ -385,7 +386,7 @@ public class ActiveRepaintManager extends RepaintManager } else if (root != null) { if (DEBUG) { - Log.info("Repainting old-school [comp=" + toString(comp) + + log.info("Repainting old-school [comp=" + toString(comp) + ", ocomp=" + toString(ocomp) + ", root=" + toString(root) + ", bounds=" + StringUtil.toString(_cbounds) + "]."); dumpHierarchy(comp); @@ -431,7 +432,7 @@ public class ActiveRepaintManager extends RepaintManager protected static void dumpHierarchy (Component comp) { for (String indent = ""; comp != null; indent += " ") { - Log.info(indent + toString(comp)); + log.info(indent + toString(comp)); comp = comp.getParent(); } } diff --git a/src/java/com/threerings/media/BackFrameManager.java b/src/java/com/threerings/media/BackFrameManager.java index c08d0dc0..37e30f42 100644 --- a/src/java/com/threerings/media/BackFrameManager.java +++ b/src/java/com/threerings/media/BackFrameManager.java @@ -27,6 +27,8 @@ import java.awt.GraphicsConfiguration; import java.awt.Rectangle; import java.awt.image.VolatileImage; +import static com.threerings.media.Log.log; + /** * A {@link FrameManager} extension that uses a volatile off-screen image * to do its rendering. @@ -53,7 +55,7 @@ public class BackFrameManager extends FrameManager // if we've changed resolutions, recreate the buffer if (valres == VolatileImage.IMAGE_INCOMPATIBLE) { - Log.info("Back buffer incompatible, recreating."); + log.info("Back buffer incompatible, recreating."); createBackBuffer(gc); } diff --git a/src/java/com/threerings/media/FlipFrameManager.java b/src/java/com/threerings/media/FlipFrameManager.java index 096994ed..742aa6d5 100644 --- a/src/java/com/threerings/media/FlipFrameManager.java +++ b/src/java/com/threerings/media/FlipFrameManager.java @@ -28,6 +28,8 @@ import java.awt.ImageCapabilities; import java.awt.Rectangle; import java.awt.image.BufferStrategy; +import static com.threerings.media.Log.log; + /** * A {@link FrameManager} extension that uses a flip-buffer (via {@link * BufferStrategy} to do its rendering. @@ -45,7 +47,7 @@ public class FlipFrameManager extends FrameManager try { _window.createBufferStrategy(2, cap); } catch (AWTException ae) { - Log.warning("Failed creating flip bufstrat: " + ae + "."); + log.warning("Failed creating flip bufstrat: " + ae + "."); // fall back to one without custom capabilities _window.createBufferStrategy(2); } @@ -62,7 +64,7 @@ public class FlipFrameManager extends FrameManager // dirty everything if we're not incrementally rendering if (!incremental) { - Log.info("Doing non-incremental render; contents lost " + + log.info("Doing non-incremental render; contents lost " + "[lost=" + _bufstrat.contentsLost() + ", rest=" + _bufstrat.contentsRestored() + "]."); _root.getRootPane().revalidate(); diff --git a/src/java/com/threerings/media/FrameManager.java b/src/java/com/threerings/media/FrameManager.java index c5c57adc..b8e065cc 100644 --- a/src/java/com/threerings/media/FrameManager.java +++ b/src/java/com/threerings/media/FrameManager.java @@ -36,11 +36,15 @@ import com.samskivert.swing.RuntimeAdjust; import com.samskivert.util.ListUtil; import com.samskivert.util.RunAnywhere; import com.samskivert.util.StringUtil; + +import com.threerings.util.unsafe.Unsafe; + import com.threerings.media.timer.CalibratingTimer; import com.threerings.media.timer.MediaTimer; import com.threerings.media.timer.MillisTimer; import com.threerings.media.util.TrailingAverage; -import com.threerings.util.unsafe.Unsafe; + +import static com.threerings.media.Log.log; /** * Provides a central point from which the computation for each "frame" or tick can be dispatched. @@ -132,7 +136,7 @@ public abstract class FrameManager } } if (timer == null) { - Log.info("Can't use high performance timer, reverting to " + + log.info("Can't use high performance timer, reverting to " + "System.currentTimeMillis() based timer."); timer = new MillisTimer(); } @@ -172,7 +176,7 @@ public abstract class FrameManager { Object[] nparts = ListUtil.testAndAddRef(_participants, participant); if (nparts == null) { - Log.warning("Refusing to add duplicate frame participant! " + participant); + log.warning("Refusing to add duplicate frame participant! " + participant); } else { _participants = nparts; } @@ -395,7 +399,7 @@ public abstract class FrameManager { long gap = tickStamp - _lastTickStamp; if (_lastTickStamp != 0 && gap > (HANG_DEBUG ? HANG_GAP : BIG_GAP)) { - Log.debug("Long tick delay [delay=" + gap + "ms]."); + log.debug("Long tick delay [delay=" + gap + "ms]."); } _lastTickStamp = tickStamp; @@ -403,8 +407,7 @@ public abstract class FrameManager try { _repainter.validateComponents(); } catch (Throwable t) { - Log.warning("Failure validating components."); - Log.logStackTrace(t); + log.warning("Failure validating components.", t); } // tick all of our frame participants @@ -425,15 +428,14 @@ public abstract class FrameManager if (HANG_DEBUG) { long delay = (System.currentTimeMillis() - start); if (delay > HANG_GAP) { - Log.info("Whoa nelly! Ticker took a long time " + + log.info("Whoa nelly! Ticker took a long time " + "[part=" + part + ", time=" + delay + "ms]."); } } } catch (Throwable t) { - Log.warning("Frame participant choked during tick " + - "[part=" + StringUtil.safeToString(part) + "]."); - Log.logStackTrace(t); + log.warning("Frame participant choked during tick " + + "[part=" + StringUtil.safeToString(part) + "].", t); } } @@ -506,8 +508,7 @@ public abstract class FrameManager } catch (Throwable t) { String ptos = StringUtil.safeToString(part); - Log.warning("Frame participant choked during paint [part=" + ptos + "]."); - Log.logStackTrace(t); + log.warning("Frame participant choked during paint [part=" + ptos + "].", t); } // render any components in our layered pane that are not in the default layer @@ -517,7 +518,7 @@ public abstract class FrameManager if (HANG_DEBUG) { long delay = (System.currentTimeMillis() - start); if (delay > HANG_GAP) { - Log.warning("Whoa nelly! Painter took a long time " + + log.warning("Whoa nelly! Painter took a long time " + "[part=" + part + ", time=" + delay + "ms]."); } } @@ -603,8 +604,7 @@ public abstract class FrameManager try { comp.paint(g); } catch (Exception e) { - Log.warning("Component choked while rendering."); - Log.logStackTrace(e); + log.warning("Component choked while rendering.", e); } g.translate(-_tbounds.x, -_tbounds.y); } @@ -615,7 +615,7 @@ public abstract class FrameManager { public void run () { - Log.info("Frame manager ticker running " + + log.info("Frame manager ticker running " + "[sleepGran=" + _sleepGranularity.getValue() + "]."); while (_running) { long start = 0L; @@ -629,14 +629,14 @@ public abstract class FrameManager getPerfMetrics()[0].record((int)(woke-start)/100); int elapsed = (int)(woke-start); if (elapsed > _sleepGranularity.getValue()*1500) { - Log.warning("Long tick [elapsed=" + elapsed + "us]."); + log.warning("Long tick [elapsed=" + elapsed + "us]."); } } // work around sketchy bug on WinXP that causes the clock to leap into the past // from time to time if (woke < _lastAttempt) { - Log.warning("Zoiks! We've leapt into the past, coping as best we can " + + log.warning("Zoiks! We've leapt into the past, coping as best we can " + "[dt=" + (woke - _lastAttempt) + "]."); _lastAttempt = woke; } diff --git a/src/java/com/threerings/media/IconManager.java b/src/java/com/threerings/media/IconManager.java index adbc1255..33b0d737 100644 --- a/src/java/com/threerings/media/IconManager.java +++ b/src/java/com/threerings/media/IconManager.java @@ -41,6 +41,8 @@ import com.threerings.media.tile.TileIcon; import com.threerings.media.tile.TileManager; import com.threerings.media.tile.TileSet; +import static com.threerings.media.Log.log; + /** * Manages the creation of icons from tileset images. The icon manager is * provided with a configuration file, which maps icon set identifiers to @@ -149,7 +151,7 @@ public class IconManager return new TileIcon(set.getTile(index)); } catch (Exception e) { - Log.warning("Unable to load icon [iconSet=" + iconSet + + log.warning("Unable to load icon [iconSet=" + iconSet + ", index=" + index + ", error=" + e + "]."); } diff --git a/src/java/com/threerings/media/Log.java b/src/java/com/threerings/media/Log.java index f1cee849..24fc910f 100644 --- a/src/java/com/threerings/media/Log.java +++ b/src/java/com/threerings/media/Log.java @@ -21,39 +21,13 @@ package com.threerings.media; -import java.util.logging.Level; -import java.util.logging.Logger; +import com.samskivert.util.Logger; /** - * A placeholder class that contains a reference to the log object used by - * the media services package. + * Contains a reference to the log object used by the media services package. */ public class Log { /** We dispatch our log messages through this logger. */ public static Logger log = Logger.getLogger("com.threerings.media"); - - /** 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); - } } diff --git a/src/java/com/threerings/media/ManagedJApplet.java b/src/java/com/threerings/media/ManagedJApplet.java index 14177499..a32b5aa3 100644 --- a/src/java/com/threerings/media/ManagedJApplet.java +++ b/src/java/com/threerings/media/ManagedJApplet.java @@ -30,7 +30,7 @@ import java.awt.Window; import javax.swing.JApplet; import javax.swing.RepaintManager; -import com.threerings.media.Log; +import static com.threerings.media.Log.log; /** * When using the {@link FrameManager} in an Applet, one must use this diff --git a/src/java/com/threerings/media/ManagedJFrame.java b/src/java/com/threerings/media/ManagedJFrame.java index 96f1b653..5780df00 100644 --- a/src/java/com/threerings/media/ManagedJFrame.java +++ b/src/java/com/threerings/media/ManagedJFrame.java @@ -32,7 +32,7 @@ import javax.swing.JFrame; import com.samskivert.util.StringUtil; -import com.threerings.media.Log; +import static com.threerings.media.Log.log; /** * When using the {@link FrameManager}, one must use this top-level frame diff --git a/src/java/com/threerings/media/MediaPanel.java b/src/java/com/threerings/media/MediaPanel.java index 25f8241d..37222eb8 100644 --- a/src/java/com/threerings/media/MediaPanel.java +++ b/src/java/com/threerings/media/MediaPanel.java @@ -57,6 +57,8 @@ import com.threerings.media.sprite.action.CommandSprite; import com.threerings.media.sprite.action.DisableableSprite; import com.threerings.media.sprite.action.HoverSprite; +import static com.threerings.media.Log.log; + /** * Provides a useful extensible framework for rendering animated displays that use sprites and * animations. Sprites and animations can be added to this panel and they will automatically be @@ -291,7 +293,7 @@ public class MediaPanel extends JComponent public void setOpaque (boolean opaque) { if (!opaque) { - Log.warning("Media panels shouldn't be setOpaque(false)."); + log.warning("Media panels shouldn't be setOpaque(false)."); Thread.dumpStack(); } super.setOpaque(true); @@ -346,8 +348,7 @@ public class MediaPanel extends JComponent try { paint(gfx, dirty); } catch (Throwable t) { - Log.warning(this + " choked in paint(" + dirty + ")."); - Log.logStackTrace(t); + log.warning(this + " choked in paint(" + dirty + ").", t); } // render our performance debugging if it's enabled @@ -383,7 +384,7 @@ public class MediaPanel extends JComponent Rectangle clip = dirty[ii]; // sanity-check the dirty rectangle if (clip == null) { - Log.warning("Found null dirty rect painting media panel?!"); + log.warning("Found null dirty rect painting media panel?!"); Thread.dumpStack(); continue; } diff --git a/src/java/com/threerings/media/MetaMediaManager.java b/src/java/com/threerings/media/MetaMediaManager.java index 06a6f8dc..73a1795f 100644 --- a/src/java/com/threerings/media/MetaMediaManager.java +++ b/src/java/com/threerings/media/MetaMediaManager.java @@ -38,6 +38,8 @@ import com.threerings.media.sprite.SpriteManager; import com.threerings.media.animation.Animation; import com.threerings.media.animation.AnimationManager; +import static com.threerings.media.Log.log; + /** * Coordinates interaction between a sprite and animation manager and the media host that hosts and * renders them. This class is a little fiddly because {@link MediaPanel} has been around a long @@ -98,7 +100,7 @@ public class MetaMediaManager { // sanity check if ((paused && (_pauseTime != 0)) || (!paused && (_pauseTime == 0))) { - Log.warning("Requested to pause when paused or vice-versa [paused=" + paused + "]."); + log.warning("Requested to pause when paused or vice-versa [paused=" + paused + "]."); return; } diff --git a/src/java/com/threerings/media/RegionManager.java b/src/java/com/threerings/media/RegionManager.java index fd978990..93cb82e7 100644 --- a/src/java/com/threerings/media/RegionManager.java +++ b/src/java/com/threerings/media/RegionManager.java @@ -23,11 +23,12 @@ package com.threerings.media; import java.awt.EventQueue; import java.awt.Rectangle; - import java.util.ArrayList; import com.samskivert.util.StringUtil; +import static com.threerings.resource.Log.log; + /** * Manages regions (rectangles) that are invalidated in the process of ticking animations and * sprites and generally doing other display related business. @@ -64,13 +65,13 @@ public class RegionManager { // make sure we're on an AWT thread if (!EventQueue.isDispatchThread()) { - Log.warning("Oi! Region dirtied on non-AWT thread [rect=" + rect + "]."); + log.warning("Oi! Region dirtied on non-AWT thread [rect=" + rect + "]."); Thread.dumpStack(); } // sanity check if (rect == null) { - Log.warning("Attempt to dirty a null rect!?"); + log.warning("Attempt to dirty a null rect!?"); Thread.dumpStack(); return; } @@ -78,7 +79,7 @@ public class RegionManager // more sanity checking long x = rect.x, y = rect.y; if ((Math.abs(x) > Integer.MAX_VALUE/2) || (Math.abs(y) > Integer.MAX_VALUE/2)) { - Log.warning("Requested to dirty questionable region " + + log.warning("Requested to dirty questionable region " + "[rect=" + StringUtil.toString(rect) + "]."); return; // Let's not do it! } @@ -93,7 +94,7 @@ public class RegionManager protected final boolean isValidSize (int width, int height) { if (width < 0 || height < 0) { - Log.warning("Attempt to add invalid dirty region?! " + + log.warning("Attempt to add invalid dirty region?! " + "[size=" + width + "x" + height + "]."); Thread.dumpStack(); return false; diff --git a/src/java/com/threerings/media/VirtualMediaPanel.java b/src/java/com/threerings/media/VirtualMediaPanel.java index b77c7208..8bb27729 100644 --- a/src/java/com/threerings/media/VirtualMediaPanel.java +++ b/src/java/com/threerings/media/VirtualMediaPanel.java @@ -37,6 +37,8 @@ import com.threerings.media.image.Mirage; import com.threerings.media.util.MathUtil; import com.threerings.media.util.Pathable; +import static com.threerings.media.Log.log; + /** * Extends the base media panel with the notion of a virtual coordinate * system. All entities in the virtual media panel have virtual @@ -236,7 +238,7 @@ public class VirtualMediaPanel extends MediaPanel // determine how far we'll be moving on this tick int dx = _nx - _vbounds.x, dy = _ny - _vbounds.y; -// Log.info("Scrolling into place [n=(" + _nx + ", " + _ny + +// log.info("Scrolling into place [n=(" + _nx + ", " + _ny + // "), t=(" + _vbounds.x + ", " + _vbounds.y + // "), d=(" + dx + ", " + dy + // "), width=" + width + ", height=" + height + "]."); @@ -334,7 +336,7 @@ public class VirtualMediaPanel extends MediaPanel break; default: - Log.warning("Eh? Set to invalid pathable mode " + + log.warning("Eh? Set to invalid pathable mode " + "[mode=" + _fmode + "]."); break; } diff --git a/src/java/com/threerings/media/animation/AnimationArranger.java b/src/java/com/threerings/media/animation/AnimationArranger.java index 79eedd43..b62e556e 100644 --- a/src/java/com/threerings/media/animation/AnimationArranger.java +++ b/src/java/com/threerings/media/animation/AnimationArranger.java @@ -27,7 +27,7 @@ import java.util.ArrayList; import com.samskivert.swing.util.SwingUtil; -import com.threerings.media.Log; +import static com.threerings.media.Log.log; /** * A utility class for positioning animations such that they don't overlap, @@ -61,7 +61,7 @@ public class AnimationArranger protected AnimationAdapter _avoidAnimObs = new AnimationAdapter() { public void animationCompleted (Animation anim, long when) { if (!_avoidAnims.remove(anim)) { - Log.warning("Couldn't remove avoid animation?! " + anim + "."); + log.warning("Couldn't remove avoid animation?! " + anim + "."); } } }; diff --git a/src/java/com/threerings/media/animation/AnimationSequencer.java b/src/java/com/threerings/media/animation/AnimationSequencer.java index fb6250da..313a10a1 100644 --- a/src/java/com/threerings/media/animation/AnimationSequencer.java +++ b/src/java/com/threerings/media/animation/AnimationSequencer.java @@ -28,7 +28,7 @@ import java.util.ArrayList; import com.samskivert.util.StringUtil; -import com.threerings.media.Log; +import static com.threerings.media.Log.log; /** * An animation that provides facilities for adding a sequence of @@ -245,7 +245,7 @@ public class AnimationSequencer extends Animation try { _completionAction.run(); } catch (Throwable t) { - Log.logStackTrace(t); + log.warning(t); } } diff --git a/src/java/com/threerings/media/animation/FadeAnimation.java b/src/java/com/threerings/media/animation/FadeAnimation.java index e466bf76..858a76b5 100644 --- a/src/java/com/threerings/media/animation/FadeAnimation.java +++ b/src/java/com/threerings/media/animation/FadeAnimation.java @@ -26,9 +26,10 @@ import java.awt.Composite; import java.awt.Graphics2D; import java.awt.Rectangle; -import com.threerings.media.Log; import com.threerings.media.effects.FadeEffect; +import static com.threerings.media.Log.log; + /** * An animation that displays an image fading from one alpha level to * another in specified increments over time. The animation is finished diff --git a/src/java/com/threerings/media/animation/FadeLabelAnimation.java b/src/java/com/threerings/media/animation/FadeLabelAnimation.java index a0e116e9..28990d3c 100644 --- a/src/java/com/threerings/media/animation/FadeLabelAnimation.java +++ b/src/java/com/threerings/media/animation/FadeLabelAnimation.java @@ -29,7 +29,7 @@ import java.awt.RenderingHints; import com.samskivert.swing.Label; import com.samskivert.swing.util.SwingUtil; -import com.threerings.media.Log; +import static com.threerings.media.Log.log; /** * Does something extraordinary. diff --git a/src/java/com/threerings/media/animation/SparkAnimation.java b/src/java/com/threerings/media/animation/SparkAnimation.java index db7b338b..603914f7 100644 --- a/src/java/com/threerings/media/animation/SparkAnimation.java +++ b/src/java/com/threerings/media/animation/SparkAnimation.java @@ -32,7 +32,7 @@ import com.samskivert.util.RandomUtil; import com.threerings.media.animation.Animation; import com.threerings.media.image.Mirage; -import com.threerings.media.Log; +import static com.threerings.media.Log.log; /** * Displays a set of spark images originating from a specified position diff --git a/src/java/com/threerings/media/image/BackedVolatileMirage.java b/src/java/com/threerings/media/image/BackedVolatileMirage.java index b4dadf5b..4ac39275 100644 --- a/src/java/com/threerings/media/image/BackedVolatileMirage.java +++ b/src/java/com/threerings/media/image/BackedVolatileMirage.java @@ -25,7 +25,7 @@ import java.awt.Graphics; import java.awt.Rectangle; import java.awt.image.BufferedImage; -import com.threerings.media.Log; +import static com.threerings.media.Log.log; /** * Provides a volatile mirage that is backed by a buffered image that is @@ -63,8 +63,7 @@ public class BackedVolatileMirage extends VolatileMirage gfx.drawImage(_source, -_bounds.x, -_bounds.y, null); } catch (Exception e) { - Log.warning("Failure refreshing mirage " + this + "."); - Log.logStackTrace(e); + log.warning("Failure refreshing mirage " + this + ".", e); } finally { gfx.dispose(); diff --git a/src/java/com/threerings/media/image/CachedVolatileMirage.java b/src/java/com/threerings/media/image/CachedVolatileMirage.java index 21315c00..c4680af1 100644 --- a/src/java/com/threerings/media/image/CachedVolatileMirage.java +++ b/src/java/com/threerings/media/image/CachedVolatileMirage.java @@ -26,7 +26,7 @@ import java.awt.Rectangle; import java.awt.Transparency; import java.awt.image.BufferedImage; -import com.threerings.media.Log; +import static com.threerings.media.Log.log; /** * A mirage implementation which allows the image to be maintained in @@ -76,8 +76,7 @@ public class CachedVolatileMirage extends VolatileMirage } } catch (Exception e) { - Log.warning("Failure refreshing mirage " + this + "."); - Log.logStackTrace(e); + log.warning("Failure refreshing mirage " + this + ".", e); } finally { if (gfx != null) { diff --git a/src/java/com/threerings/media/image/ColorPository.java b/src/java/com/threerings/media/image/ColorPository.java index e84ec80a..fd5c0ccb 100644 --- a/src/java/com/threerings/media/image/ColorPository.java +++ b/src/java/com/threerings/media/image/ColorPository.java @@ -36,10 +36,11 @@ import com.samskivert.util.HashIntMap; import com.samskivert.util.RandomUtil; import com.samskivert.util.StringUtil; -import com.threerings.media.Log; import com.threerings.resource.ResourceManager; import com.threerings.util.CompiledConfig; +import static com.threerings.media.Log.log; + /** * A repository of image recoloration information. It was called the * recolor repository but the re-s cancelled one another out. @@ -81,7 +82,7 @@ public class ColorPository implements Serializable { // validate the color id if (record.colorId > 255) { - Log.warning("Refusing to add color record; colorId > 255 " + + log.warning("Refusing to add color record; colorId > 255 " + "[class=" + this + ", record=" + record + "]."); } else { record.cclass = this; @@ -145,7 +146,7 @@ public class ColorPository implements Serializable // sanity check if (_starters.length < 1) { - Log.warning("Requested random starting color from " + + log.warning("Requested random starting color from " + "colorless component class " + this + "]."); return null; } @@ -362,7 +363,7 @@ public class ColorPository implements Serializable try { colorId = crec.getColorId(colorName); } catch (ParseException pe) { - Log.info("Error getting colorization by name. [error=" + pe + "]"); + log.info("Error getting colorization by name. [error=" + pe + "]"); return null; } @@ -387,7 +388,7 @@ public class ColorPository implements Serializable return crec; } } - Log.warning("No such color class [class=" + className + "]."); + log.warning("No such color class [class=" + className + "]."); Thread.dumpStack(); return null; } @@ -402,7 +403,7 @@ public class ColorPository implements Serializable // if they request color class zero, we assume they're just // decoding a blank colorprint, otherwise we complain if (classId != 0) { - Log.warning("Requested unknown color class " + + log.warning("Requested unknown color class " + "[classId=" + classId + ", colorId=" + colorId + "]."); Thread.dumpStack(); @@ -419,7 +420,7 @@ public class ColorPository implements Serializable { ClassRecord record = getClassRecord(className); if (record == null) { - Log.warning("Requested unknown color class " + + log.warning("Requested unknown color class " + "[className=" + className + ", colorName=" + colorName + "]."); Thread.dumpStack(); return null; @@ -429,7 +430,7 @@ public class ColorPository implements Serializable try { colorId = record.getColorId(colorName); } catch (ParseException pe) { - Log.info("Error getting color record by name. [error=" + pe + "]"); + log.info("Error getting color record by name. [error=" + pe + "]"); return null; } @@ -444,7 +445,7 @@ public class ColorPository implements Serializable { // validate the class id if (record.classId > 255) { - Log.warning("Refusing to add class; classId > 255 " + record + "."); + log.warning("Refusing to add class; classId > 255 " + record + "."); } else { _classes.put(record.classId, record); } @@ -459,7 +460,7 @@ public class ColorPository implements Serializable try { return loadColorPository(rmgr.getResource(CONFIG_PATH)); } catch (IOException ioe) { - Log.warning("Failure loading color pository [path=" + CONFIG_PATH + + log.warning("Failure loading color pository [path=" + CONFIG_PATH + ", error=" + ioe + "]."); return new ColorPository(); } @@ -474,7 +475,7 @@ public class ColorPository implements Serializable try { return (ColorPository)CompiledConfig.loadConfig(source); } catch (IOException ioe) { - Log.warning("Failure loading color pository: " + ioe + "."); + log.warning("Failure loading color pository: " + ioe + "."); return new ColorPository(); } } @@ -488,7 +489,7 @@ public class ColorPository implements Serializable try { CompiledConfig.saveConfig(path, posit); } catch (IOException ioe) { - Log.warning("Failure saving color pository " + + log.warning("Failure saving color pository " + "[path=" + path + ", error=" + ioe + "]."); } } diff --git a/src/java/com/threerings/media/image/ImageManager.java b/src/java/com/threerings/media/image/ImageManager.java index d156af88..88e395fa 100644 --- a/src/java/com/threerings/media/image/ImageManager.java +++ b/src/java/com/threerings/media/image/ImageManager.java @@ -22,9 +22,10 @@ import com.samskivert.util.StringUtil; import com.samskivert.util.Throttle; import com.samskivert.util.Tuple; -import com.threerings.media.Log; import com.threerings.resource.ResourceManager; +import static com.threerings.media.Log.log; + /** * Provides a single point of access for image retrieval and caching. This does not include * any tie-in to runtime adjustments to control caching and mirage creation. @@ -95,7 +96,7 @@ public class ImageManager // create our image cache int icsize = getCacheSize(); - Log.debug("Creating image cache [size=" + icsize + "k]."); + log.debug("Creating image cache [size=" + icsize + "k]."); _ccache = new LRUHashMap(icsize * 1024, new LRUHashMap.ItemSizer() { public int computeSize (Object value) { return (int)((CacheRecord)value).getEstimatedMemoryUsage(); @@ -126,7 +127,7 @@ public class ImageManager */ public void clearCache () { - Log.info("Clearing image manager cache."); + log.info("Clearing image manager cache."); _ccache.clear(); } @@ -265,7 +266,7 @@ public class ImageManager // load up the raw image BufferedImage image = loadImage(key); if (image == null) { - Log.warning("Failed to load image " + key + "."); + log.warning("Failed to load image " + key + "."); // create a blank image instead image = new BufferedImage(10, 10, BufferedImage.TYPE_BYTE_INDEXED); } @@ -396,15 +397,14 @@ public class ImageManager BufferedImage image = null; try { - Log.debug("Loading image " + key + "."); + log.debug("Loading image " + key + "."); image = key.daprov.loadImage(key.path); if (image == null) { - Log.warning("ImageDataProvider.loadImage(" + key + ") returned null."); + log.warning("ImageDataProvider.loadImage(" + key + ") returned null."); } } catch (Exception e) { - Log.warning("Unable to load image '" + key + "'."); - Log.logStackTrace(e); + log.warning("Unable to load image '" + key + "'.", e); // create a blank image in its stead image = createImage(1, 1, Transparency.OPAQUE); @@ -435,7 +435,7 @@ public class ImageManager } eff = _ccache.getTrackedEffectiveness(); } - Log.info("ImageManager LRU [mem=" + (size / 1024) + "k, size=" + _ccache.size() + + log.info("ImageManager LRU [mem=" + (size / 1024) + "k, size=" + _ccache.size() + ", hits=" + eff[0] + ", misses=" + eff[1] + ", totalKeys=" + _keySet.size() + "]."); } @@ -476,7 +476,7 @@ public class ImageManager return cimage; } catch (Exception re) { - Log.warning("Failure recoloring image [source" + _key + + log.warning("Failure recoloring image [source" + _key + ", zations=" + StringUtil.toString(zations) + ", error=" + re + "]."); // return the uncolorized version return _source; @@ -535,4 +535,4 @@ public class ImageManager /** Default amount of data we'll store in our image cache. */ protected static int DEFAULT_CACHE_SIZE = 32768; -} \ No newline at end of file +} diff --git a/src/java/com/threerings/media/image/TransformedMirage.java b/src/java/com/threerings/media/image/TransformedMirage.java index 0ac63019..0559e8b0 100644 --- a/src/java/com/threerings/media/image/TransformedMirage.java +++ b/src/java/com/threerings/media/image/TransformedMirage.java @@ -29,7 +29,7 @@ import java.awt.geom.AffineTransform; import java.awt.geom.NoninvertibleTransformException; import java.awt.image.BufferedImage; -import com.threerings.media.Log; +import static com.threerings.media.Log.log; /** * Draws a mirage combined with an arbitrary AffineTransform. diff --git a/src/java/com/threerings/media/sound/Mp3Player.java b/src/java/com/threerings/media/sound/Mp3Player.java index 48973c32..47e89a7a 100644 --- a/src/java/com/threerings/media/sound/Mp3Player.java +++ b/src/java/com/threerings/media/sound/Mp3Player.java @@ -32,7 +32,7 @@ import javax.sound.sampled.DataLine; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.SourceDataLine; -import com.threerings.media.Log; +import static com.threerings.media.Log.log; /** * Plays mp3 files. Depends on three external jar files that aren't even @@ -69,7 +69,7 @@ public class Mp3Player extends MusicPlayer inStream = AudioSystem.getAudioInputStream( new BufferedInputStream(stream, BUFFER_SIZE)); } catch (Exception e) { - Log.warning("MP3 fuckola. [e=" + e + "]."); + log.warning("MP3 fuckola. [e=" + e + "]."); return; } @@ -85,7 +85,7 @@ public class Mp3Player extends MusicPlayer _line = (SourceDataLine) AudioSystem.getLine(info); _line.open(format); } catch (LineUnavailableException lue) { - Log.warning("MP3 line unavailable: " + lue); + log.warning("MP3 line unavailable: " + lue); return; } @@ -97,7 +97,7 @@ public class Mp3Player extends MusicPlayer try { count = inStream.read(data, 0, data.length); } catch (IOException ioe) { - Log.warning("Error reading MP3: " + ioe); + log.warning("Error reading MP3: " + ioe); break; } if (count >= 0) { diff --git a/src/java/com/threerings/media/sound/MusicManager.java b/src/java/com/threerings/media/sound/MusicManager.java index fa61266f..20465312 100644 --- a/src/java/com/threerings/media/sound/MusicManager.java +++ b/src/java/com/threerings/media/sound/MusicManager.java @@ -28,7 +28,7 @@ import com.samskivert.util.Config; import com.samskivert.util.RandomUtil; import com.samskivert.util.RunQueue; -import com.threerings.media.Log; +import static com.threerings.media.Log.log; /** * Manages the playing of audio files. @@ -164,7 +164,7 @@ public class MusicManager } } - Log.debug("Sequence stopped that wasn't in the stack anymore [key=" + mkey + "]."); + log.debug("Sequence stopped that wasn't in the stack anymore [key=" + mkey + "]."); } /** @@ -188,7 +188,7 @@ public class MusicManager Config c = _smgr.getConfig(info); String[] names = c.getValue(info.key, (String[])null); if ((names == null) || (names.length == 0)) { - Log.warning("No such music [key=" + info + "]."); + log.warning("No such music [key=" + info + "]."); _musicStack.removeFirst(); playTopMusic(); return; @@ -216,7 +216,7 @@ public class MusicManager _musicPlayer.init(_playerListener); } catch (Exception e) { - Log.warning("Unable to instantiate music player [class=" + playerClass + + log.warning("Unable to instantiate music player [class=" + playerClass + ", e=" + e + "]."); // scrap it, try again with the next song @@ -235,7 +235,7 @@ public class MusicManager // TODO: buffer for the music player? _musicPlayer.start(_smgr._rmgr.getResource(bundle, music)); } catch (Exception e) { - Log.warning("Error playing music, skipping [e=" + e + + log.warning("Error playing music, skipping [e=" + e + ", bundle=" + bundle + ", music=" + music + "]."); _musicStack.removeFirst(); playTopMusic(); diff --git a/src/java/com/threerings/media/sound/SoundManager.java b/src/java/com/threerings/media/sound/SoundManager.java index ad2acfc2..ac13dc60 100644 --- a/src/java/com/threerings/media/sound/SoundManager.java +++ b/src/java/com/threerings/media/sound/SoundManager.java @@ -57,9 +57,10 @@ import com.samskivert.util.StringUtil; import com.threerings.resource.ResourceManager; -import com.threerings.media.Log; import com.threerings.media.MediaPrefs; +import static com.threerings.media.Log.log; + /** * Manages the playing of audio files. */ @@ -363,11 +364,11 @@ public class SoundManager boolean queued = enqueue(skey, true); if (queued) { if (_verbose.getValue()) { - Log.info("Sound request [key=" + skey.key + "]."); + log.info("Sound request [key=" + skey.key + "]."); } } else /* if (_verbose.getValue()) */ { - Log.warning("SoundManager not playing sound because too many sounds in queue " + + log.warning("SoundManager not playing sound because too many sounds in queue " + "[key=" + skey + "]."); } } @@ -433,7 +434,7 @@ public class SoundManager processKey(key); } catch (Exception e) { - Log.logStackTrace(e); + log.warning(e); } } } @@ -516,7 +517,7 @@ public class SoundManager } else if (key.isExpired()) { if (_verbose.getValue()) { - Log.info("Sound expired [key=" + key.key + "]."); + log.info("Sound expired [key=" + key.key + "]."); } return; @@ -563,7 +564,7 @@ public class SoundManager } catch (IOException e) { // this shouldn't ever ever happen because the stream // we're given is from a reliable source - Log.warning("Error reading clip data! [e=" + e + "]."); + log.warning("Error reading clip data! [e=" + e + "]."); return; } @@ -610,19 +611,19 @@ public class SoundManager } catch (InterruptedException ie) { } } catch (IOException ioe) { - Log.warning("Error loading sound file [key=" + key + ", e=" + ioe + "]."); + log.warning("Error loading sound file [key=" + key + ", e=" + ioe + "]."); } catch (UnsupportedAudioFileException uafe) { - Log.warning("Unsupported sound format [key=" + key + ", e=" + uafe + "]."); + log.warning("Unsupported sound format [key=" + key + ", e=" + uafe + "]."); } catch (LineUnavailableException lue) { String err = "Line not available to play sound [key=" + key.key + ", e=" + lue + "]."; if (_soundSeemsToWork) { - Log.warning(err); + log.warning(err); } else { // this error comes every goddamned time we play a sound on someone with a // misconfigured sound card, so let's just keep it to ourselves - Log.debug(err); + log.debug(err); } } finally { @@ -676,7 +677,7 @@ public class SoundManager Config c = getConfig(key); String[] names = c.getValue(key.key, (String[])null); if (names == null) { - Log.warning("No such sound [key=" + key + "]."); + log.warning("No such sound [key=" + key + "]."); return null; } @@ -739,7 +740,7 @@ public class SoundManager try { return new FileInputStream(pick); } catch (Exception e) { - Log.warning("Error reading test sound [e=" + e + ", file=" + pick + "]."); + log.warning("Error reading test sound [e=" + e + ", file=" + pick + "]."); } } return null; @@ -761,7 +762,7 @@ public class SoundManager } catch (FileNotFoundException fnfe2) { // only play the default sound if we have verbose sound debugging turned on. if (_verbose.getValue()) { - Log.warning("Could not locate sound data [bundle=" + bundle + + log.warning("Could not locate sound data [bundle=" + bundle + ", path=" + path + "]."); if (_defaultClipPath != null) { try { @@ -770,14 +771,14 @@ public class SoundManager try { clipin = _rmgr.getResource(_defaultClipPath); } catch (FileNotFoundException fnfe4) { - Log.warning("Additionally, the default " + + log.warning("Additionally, the default " + "fallback sound could not be located " + "[bundle=" + _defaultClipBundle + ", path=" + _defaultClipPath + "]."); } } } else { - Log.warning("No fallback default sound specified!"); + log.warning("No fallback default sound specified!"); } } // if we couldn't load the default, rethrow @@ -803,7 +804,7 @@ public class SoundManager props = ConfigUtil.loadInheritedProperties( propPath + ".properties", _rmgr.getClassLoader()); } catch (IOException ioe) { - Log.warning("Failed to load sound properties " + + log.warning("Failed to load sound properties " + "[path=" + propPath + ", error=" + ioe + "]."); } c = new Config(propPath, props); @@ -865,7 +866,7 @@ public class SoundManager FloatControl control = (FloatControl) line.getControl(FloatControl.Type.PAN); control.setValue(pan); } catch (Exception e) { - Log.debug("Cannot set pan on line: " + e); + log.debug("Cannot set pan on line: " + e); } } diff --git a/src/java/com/threerings/media/sprite/Sprite.java b/src/java/com/threerings/media/sprite/Sprite.java index 1d56057f..8644b0f3 100644 --- a/src/java/com/threerings/media/sprite/Sprite.java +++ b/src/java/com/threerings/media/sprite/Sprite.java @@ -32,7 +32,7 @@ import com.threerings.media.AbstractMedia; import com.threerings.media.util.Path; import com.threerings.media.util.Pathable; -import com.threerings.media.Log; +import static com.threerings.media.Log.log; /** * The sprite class represents a single moveable object in an animated diff --git a/src/java/com/threerings/media/tile/SimpleCachingImageProvider.java b/src/java/com/threerings/media/tile/SimpleCachingImageProvider.java index 3b2c5690..4c091b59 100644 --- a/src/java/com/threerings/media/tile/SimpleCachingImageProvider.java +++ b/src/java/com/threerings/media/tile/SimpleCachingImageProvider.java @@ -27,11 +27,12 @@ import java.io.IOException; import com.samskivert.util.LRUHashMap; -import com.threerings.media.Log; import com.threerings.media.image.BufferedMirage; import com.threerings.media.image.Colorization; import com.threerings.media.image.Mirage; +import static com.threerings.media.Log.log; + /** * An image provider that can be used by command line tools to load images and provide them to * tilesets when doing things like preprocessing tileset images. @@ -47,7 +48,7 @@ public abstract class SimpleCachingImageProvider implements ImageProvider image = loadImage(path); _cache.put(path, image); } catch (IOException ioe) { - Log.warning("Failed to load image [path=" + path + ", ioe=" + ioe + "]."); + log.warning("Failed to load image [path=" + path + ", ioe=" + ioe + "]."); } } return image; diff --git a/src/java/com/threerings/media/tile/TileManager.java b/src/java/com/threerings/media/tile/TileManager.java index 2e3b66f3..51d71bf5 100644 --- a/src/java/com/threerings/media/tile/TileManager.java +++ b/src/java/com/threerings/media/tile/TileManager.java @@ -27,9 +27,10 @@ import java.util.HashMap; import com.samskivert.io.PersistenceException; -import com.threerings.media.Log; import com.threerings.media.image.ImageManager; +import static com.threerings.media.Log.log; + /** * The tile manager provides a simplified interface for retrieving and * caching tiles. Tiles can be loaded in two different ways. An @@ -170,7 +171,7 @@ public class TileManager try { return _setrep.getTileSet(tileSetId); } catch (PersistenceException pe) { - Log.warning("Failure loading tileset [id=" + tileSetId + + log.warning("Failure loading tileset [id=" + tileSetId + ", error=" + pe + "]."); throw new NoSuchTileSetException(tileSetId); } @@ -193,7 +194,7 @@ public class TileManager try { return _setrep.getTileSet(name); } catch (PersistenceException pe) { - Log.warning("Failure loading tileset [name=" + name + + log.warning("Failure loading tileset [name=" + name + ", error=" + pe + "]."); throw new NoSuchTileSetException(name); } diff --git a/src/java/com/threerings/media/tile/TileSet.java b/src/java/com/threerings/media/tile/TileSet.java index b8c03b16..0695ab1c 100644 --- a/src/java/com/threerings/media/tile/TileSet.java +++ b/src/java/com/threerings/media/tile/TileSet.java @@ -31,7 +31,6 @@ import java.util.Iterator; import com.samskivert.util.StringUtil; import com.samskivert.util.Throttle; -import com.threerings.media.Log; import com.threerings.media.image.Colorization; import com.threerings.media.image.Mirage; import com.threerings.media.image.ImageUtil; @@ -39,6 +38,8 @@ import com.threerings.media.image.BufferedMirage; import com.threerings.media.util.MultiFrameImage; import com.threerings.media.util.MultiFrameImageImpl; +import static com.threerings.media.Log.log; + /** * A tileset stores information on a single logical set of tiles. It provides a clean interface for * the {@link TileManager} or other entities to retrieve individual tiles from the tile set and @@ -126,7 +127,7 @@ public abstract class TileSet return tset; } catch (CloneNotSupportedException cnse) { - Log.warning("Unable to clone tileset prior to colorization [tset=" + this + + log.warning("Unable to clone tileset prior to colorization [tset=" + this + ", zations=" + StringUtil.toString(zations) + ", error=" + cnse + "]."); return null; } @@ -252,7 +253,7 @@ public abstract class TileSet Mirage mirage = null; if (checkTileIndex(tileIndex)) { if (_improv == null) { - Log.warning("Aiya! Tile set missing image provider [path=" + _imagePath + "]."); + log.warning("Aiya! Tile set missing image provider [path=" + _imagePath + "]."); } else { mirage = _improv.getTileImage(_imagePath, bounds, zations); } @@ -289,7 +290,7 @@ public abstract class TileSet if (timg != null) { img = timg.getSubimage(bounds.x, bounds.y, bounds.width, bounds.height); } else { - Log.warning("Missing source image " + this); + log.warning("Missing source image " + this); } } if (img == null) { @@ -318,7 +319,7 @@ public abstract class TileSet if (tileIndex >= 0 && tileIndex < tcount) { return true; } else { - Log.warning("Requested invalid tile [tset=" + this + ", index=" + tileIndex + "]."); + log.warning("Requested invalid tile [tset=" + this + ", index=" + tileIndex + "]."); Thread.dumpStack(); return false; } @@ -386,7 +387,7 @@ public abstract class TileSet } } } - Log.info("Tile caches [amem=" + (amem / 1024) + "k" + + log.info("Tile caches [amem=" + (amem / 1024) + "k" + ", tmem=" + (Tile._totalTileMemory / 1024) + "k" + ", seen=" + _atiles.size() + ", asize=" + asize + "]."); } diff --git a/src/java/com/threerings/media/tile/bundle/BundledTileSetRepository.java b/src/java/com/threerings/media/tile/bundle/BundledTileSetRepository.java index 3f93b3a5..d665fba3 100644 --- a/src/java/com/threerings/media/tile/bundle/BundledTileSetRepository.java +++ b/src/java/com/threerings/media/tile/bundle/BundledTileSetRepository.java @@ -29,13 +29,14 @@ import com.samskivert.util.HashIntMap; import com.threerings.resource.ResourceBundle; import com.threerings.resource.ResourceManager; -import com.threerings.media.Log; import com.threerings.media.image.ImageManager; import com.threerings.media.tile.IMImageProvider; import com.threerings.media.tile.NoSuchTileSetException; import com.threerings.media.tile.TileSet; import com.threerings.media.tile.TileSetRepository; +import static com.threerings.media.Log.log; + /** * Loads tileset data from a set of resource bundles. * @@ -81,7 +82,7 @@ public class BundledTileSetRepository // sanity check if (rbundles == null) { - Log.warning("Unable to fetch tileset resource set " + + log.warning("Unable to fetch tileset resource set " + "[name=" + name + "]. Perhaps it's not defined " + "in the resource manager config?"); return; @@ -127,11 +128,8 @@ public class BundledTileSetRepository addBundle(idmap, namemap, tsb); } catch (Exception e) { - Log.warning("Unable to load tileset bundle '" + - BundleUtil.METADATA_PATH + "' from resource " + - "bundle [rbundle=" + bundle + - ", error=" + e + "]."); - Log.logStackTrace(e); + log.warning("Unable to load tileset bundle '" + BundleUtil.METADATA_PATH + + "' from resource bundle [rbundle=" + bundle + "].", e); } } @@ -216,7 +214,7 @@ public class BundledTileSetRepository try { wait(); } catch (InterruptedException ie) { - Log.warning("Interrupted waiting for bundles " + ie); + log.warning("Interrupted waiting for bundles " + ie); } } } diff --git a/src/java/com/threerings/media/tile/bundle/tools/DirectoryTileSetBundler.java b/src/java/com/threerings/media/tile/bundle/tools/DirectoryTileSetBundler.java index 3baa2886..2dca51e3 100644 --- a/src/java/com/threerings/media/tile/bundle/tools/DirectoryTileSetBundler.java +++ b/src/java/com/threerings/media/tile/bundle/tools/DirectoryTileSetBundler.java @@ -35,7 +35,6 @@ import javax.imageio.ImageIO; import org.apache.commons.io.IOUtils; -import com.threerings.media.Log; import com.threerings.util.FileUtil; import com.threerings.media.tile.ImageProvider; import com.threerings.media.tile.ObjectTileSet; @@ -44,6 +43,8 @@ import com.threerings.media.tile.TrimmedObjectTileSet; import com.threerings.media.tile.bundle.BundleUtil; import com.threerings.media.tile.bundle.TileSetBundle; +import static com.threerings.media.Log.log; + public class DirectoryTileSetBundler extends TileSetBundler { public DirectoryTileSetBundler (File configFile) @@ -74,7 +75,7 @@ public class DirectoryTileSetBundler extends TileSetBundler // sanity checks if (imagePath == null) { - Log.warning("Tileset contains no image path " + + log.warning("Tileset contains no image path " + "[set=" + set + "]. It ain't gonna work."); continue; } diff --git a/src/java/com/threerings/media/tile/bundle/tools/TileSetBundler.java b/src/java/com/threerings/media/tile/bundle/tools/TileSetBundler.java index dce6b7fe..58447836 100644 --- a/src/java/com/threerings/media/tile/bundle/tools/TileSetBundler.java +++ b/src/java/com/threerings/media/tile/bundle/tools/TileSetBundler.java @@ -42,7 +42,6 @@ import org.xml.sax.SAXException; import com.samskivert.io.PersistenceException; import com.samskivert.util.HashIntMap; -import com.threerings.media.Log; import com.threerings.media.tile.ImageProvider; import com.threerings.media.tile.ObjectTileSet; import com.threerings.media.tile.SimpleCachingImageProvider; @@ -54,6 +53,8 @@ import com.threerings.media.tile.bundle.TileSetBundle; import com.threerings.media.tile.tools.xml.TileSetRuleSet; import com.threerings.resource.FastImageIO; +import static com.threerings.media.Log.log; + /** * The tileset bundler is used to create tileset bundles from a set of XML * tileset descriptions in a bundle description file. The bundles contain @@ -259,7 +260,7 @@ public class TileSetBundler // let's be robust if (name == null) { - Log.warning("Tileset was parsed, but received no name " + + log.warning("Tileset was parsed, but received no name " + "[set=" + set + "]. Skipping."); continue; } @@ -299,7 +300,7 @@ public class TileSetBundler try { idBroker.commit(); } catch (PersistenceException pe) { - Log.warning("Failure committing brokered tileset ids " + + log.warning("Failure committing brokered tileset ids " + "back to broker's persistent store " + "[error=" + pe + "]."); } @@ -373,7 +374,7 @@ public class TileSetBundler // sanity checks if (imagePath == null) { - Log.warning("Tileset contains no image path " + + log.warning("Tileset contains no image path " + "[set=" + set + "]. It ain't gonna work."); continue; } @@ -450,7 +451,7 @@ public class TileSetBundler // remove the incomplete jar file and rethrow the exception jar.close(); if (!target.delete()) { - Log.warning("Failed to close botched bundle '" + target + "'."); + log.warning("Failed to close botched bundle '" + target + "'."); } String errmsg = "Failed to create bundle " + target + ": " + e; throw (IOException) new IOException(errmsg).initCause(e); diff --git a/src/java/com/threerings/media/tile/tools/xml/SwissArmyTileSetRuleSet.java b/src/java/com/threerings/media/tile/tools/xml/SwissArmyTileSetRuleSet.java index 292cc60b..1080f5b4 100644 --- a/src/java/com/threerings/media/tile/tools/xml/SwissArmyTileSetRuleSet.java +++ b/src/java/com/threerings/media/tile/tools/xml/SwissArmyTileSetRuleSet.java @@ -29,9 +29,10 @@ import org.apache.commons.digester.Digester; import com.samskivert.util.StringUtil; import com.samskivert.xml.CallMethodSpecialRule; -import com.threerings.media.Log; import com.threerings.media.tile.SwissArmyTileSet; +import static com.threerings.media.Log.log; + /** * Parses {@link SwissArmyTileSet} instances from a tileset description. A * swiss army tileset description looks like so: @@ -96,7 +97,7 @@ public class SwissArmyTileSetRuleSet extends TileSetRuleSet if (values.length == 2) { starget.setOffsetPos(new Point(values[0], values[1])); } else { - Log.warning("Invalid 'offsetPos' definition '" + + log.warning("Invalid 'offsetPos' definition '" + bodyText + "'."); } } @@ -111,7 +112,7 @@ public class SwissArmyTileSetRuleSet extends TileSetRuleSet if (values.length == 2) { starget.setGapSize(new Dimension(values[0], values[1])); } else { - Log.warning("Invalid 'gapSize' definition '" + + log.warning("Invalid 'gapSize' definition '" + bodyText + "'."); } } @@ -126,21 +127,21 @@ public class SwissArmyTileSetRuleSet extends TileSetRuleSet // check for a element if (set.getWidths() == null) { - Log.warning("Tile set definition missing valid " + + log.warning("Tile set definition missing valid " + "element [set=" + set + "]."); valid = false; } // check for a element if (set.getHeights() == null) { - Log.warning("Tile set definition missing valid " + + log.warning("Tile set definition missing valid " + "element [set=" + set + "]."); valid = false; } // check for a element if (set.getTileCounts() == null) { - Log.warning("Tile set definition missing valid " + + log.warning("Tile set definition missing valid " + "element [set=" + set + "]."); valid = false; } diff --git a/src/java/com/threerings/media/tile/tools/xml/TileSetRuleSet.java b/src/java/com/threerings/media/tile/tools/xml/TileSetRuleSet.java index 13b863c6..f4479bfb 100644 --- a/src/java/com/threerings/media/tile/tools/xml/TileSetRuleSet.java +++ b/src/java/com/threerings/media/tile/tools/xml/TileSetRuleSet.java @@ -28,9 +28,10 @@ import com.samskivert.util.StringUtil; import com.samskivert.xml.ValidatedSetNextRule.Validator; import com.samskivert.xml.ValidatedSetNextRule; -import com.threerings.media.Log; import com.threerings.media.tile.TileSet; +import static com.threerings.media.Log.log; + /** * The tileset rule set is used to parse the base attributes of a tileset * instance. Derived classes would extend this and add rules for their own @@ -106,14 +107,14 @@ public abstract class TileSetRuleSet // check for the 'name' attribute if (StringUtil.isBlank(set.getName())) { - Log.warning("Tile set definition missing 'name' attribute " + + log.warning("Tile set definition missing 'name' attribute " + "[set=" + set + "]."); valid = false; } // check for an element if (StringUtil.isBlank(set.getImagePath())) { - Log.warning("Tile set definition missing element " + + log.warning("Tile set definition missing element " + "[set=" + set + "]."); valid = false; } diff --git a/src/java/com/threerings/media/tile/tools/xml/UniformTileSetRuleSet.java b/src/java/com/threerings/media/tile/tools/xml/UniformTileSetRuleSet.java index c5e258fc..c9ecacf0 100644 --- a/src/java/com/threerings/media/tile/tools/xml/UniformTileSetRuleSet.java +++ b/src/java/com/threerings/media/tile/tools/xml/UniformTileSetRuleSet.java @@ -23,9 +23,10 @@ package com.threerings.media.tile.tools.xml; import org.apache.commons.digester.Digester; -import com.threerings.media.Log; import com.threerings.media.tile.UniformTileSet; +import static com.threerings.media.Log.log; + /** * Parses {@link UniformTileSet} instances from a tileset description. A * uniform tileset description looks like so: @@ -69,14 +70,14 @@ public class UniformTileSetRuleSet extends TileSetRuleSet // check for a element if (set.getWidth() == 0) { - Log.warning("Tile set definition missing valid " + + log.warning("Tile set definition missing valid " + "element [set=" + set + "]."); valid = false; } // check for a element if (set.getHeight() == 0) { - Log.warning("Tile set definition missing valid " + + log.warning("Tile set definition missing valid " + "element [set=" + set + "]."); valid = false; } diff --git a/src/java/com/threerings/media/tile/tools/xml/XMLTileSetParser.java b/src/java/com/threerings/media/tile/tools/xml/XMLTileSetParser.java index 4cd15436..e369bde3 100644 --- a/src/java/com/threerings/media/tile/tools/xml/XMLTileSetParser.java +++ b/src/java/com/threerings/media/tile/tools/xml/XMLTileSetParser.java @@ -35,9 +35,10 @@ import org.xml.sax.SAXException; import com.samskivert.util.ConfigUtil; import com.samskivert.xml.ValidatedSetNextRule; -import com.threerings.media.Log; import com.threerings.media.tile.TileSet; +import static com.threerings.media.Log.log; + /** * Parse an XML tileset description file and construct tileset objects for * each valid description. Does not currently perform validation on the @@ -147,16 +148,14 @@ public class XMLTileSetParser try { _digester.parse(source); } catch (SAXException saxe) { - Log.warning("Exception parsing tile set descriptions " + - "[error=" + saxe + "]."); - Log.logStackTrace(saxe); + log.warning("Exception parsing tile set descriptions.", saxe); } // stick the tilesets from the list into the hashtable for (int i = 0; i < setlist.size(); i++) { TileSet set = (TileSet)setlist.get(i); if (set.getName() == null) { - Log.warning("Tileset did not receive name during " + + log.warning("Tileset did not receive name during " + "parsing process [set=" + set + "]."); } else { tilesets.put(set.getName(), set); diff --git a/src/java/com/threerings/media/util/BackgroundTiler.java b/src/java/com/threerings/media/util/BackgroundTiler.java index 07793296..310901aa 100644 --- a/src/java/com/threerings/media/util/BackgroundTiler.java +++ b/src/java/com/threerings/media/util/BackgroundTiler.java @@ -24,7 +24,7 @@ package com.threerings.media.util; import java.awt.Graphics; import java.awt.image.BufferedImage; -import com.threerings.media.Log; +import static com.threerings.media.Log.log; /** * Used to tile a background image into regions of various sizes. The @@ -41,7 +41,7 @@ public class BackgroundTiler { // make sure we were given the goods if (src == null) { - Log.info("Backgrounder given null source image. Coping."); + log.info("Backgrounder given null source image. Coping."); return; } @@ -56,7 +56,7 @@ public class BackgroundTiler // make sure the image suits our minimum useful dimensions if (_w3 <= 0 || _cw3 <= 0 || _h3 <= 0 || _ch3 <= 0) { - Log.warning("Backgrounder given source image of insufficient " + + log.warning("Backgrounder given source image of insufficient " + "size for tiling " + "[width=" + width + ", height=" + height + "]."); return; diff --git a/src/java/com/threerings/media/util/BobblePath.java b/src/java/com/threerings/media/util/BobblePath.java index 26dcfea1..ef31daea 100644 --- a/src/java/com/threerings/media/util/BobblePath.java +++ b/src/java/com/threerings/media/util/BobblePath.java @@ -26,7 +26,7 @@ import java.awt.Graphics2D; import com.samskivert.util.RandomUtil; -import com.threerings.media.Log; +import static com.threerings.media.Log.log; /** * Bobble a Pathable. diff --git a/src/java/com/threerings/media/util/LineSegmentPath.java b/src/java/com/threerings/media/util/LineSegmentPath.java index 318f7bd2..a6edb4f6 100644 --- a/src/java/com/threerings/media/util/LineSegmentPath.java +++ b/src/java/com/threerings/media/util/LineSegmentPath.java @@ -34,9 +34,10 @@ import com.samskivert.util.StringUtil; import com.threerings.util.DirectionCodes; import com.threerings.util.DirectionUtil; -import com.threerings.media.Log; import com.threerings.media.util.MathUtil; +import static com.threerings.media.Log.log; + /** * The line segment path is used to cause a pathable to follow a path that * is made up of a sequence of line segments. There must be at least two @@ -160,7 +161,7 @@ public class LineSegmentPath // information to compute our velocity int ncount = _nodes.size(); if (ncount < 2) { - Log.warning("Requested to set duration of bogus path " + + log.warning("Requested to set duration of bogus path " + "[path=" + this + ", duration=" + millis + "]."); return; } diff --git a/src/java/com/threerings/media/util/PathSequence.java b/src/java/com/threerings/media/util/PathSequence.java index 625db2f9..b0e72d43 100644 --- a/src/java/com/threerings/media/util/PathSequence.java +++ b/src/java/com/threerings/media/util/PathSequence.java @@ -26,7 +26,7 @@ import java.awt.Graphics2D; import java.util.ArrayList; import java.util.List; -import com.threerings.media.Log; +import static com.threerings.media.Log.log; /** * Used to create a path that is a sequence of several other paths. @@ -81,7 +81,7 @@ public class PathSequence public boolean tick (Pathable pable, long tickStamp) { if (pable != _pable) { - Log.warning("PathSequence ticked with different path than " + + log.warning("PathSequence ticked with different path than " + "it was inited with."); } return _curPath.tick(_pableRep, tickStamp); diff --git a/src/java/com/threerings/media/util/PerformanceMonitor.java b/src/java/com/threerings/media/util/PerformanceMonitor.java index fee962fb..095e13de 100644 --- a/src/java/com/threerings/media/util/PerformanceMonitor.java +++ b/src/java/com/threerings/media/util/PerformanceMonitor.java @@ -23,10 +23,11 @@ package com.threerings.media.util; import java.util.HashMap; -import com.threerings.media.Log; import com.threerings.media.timer.MediaTimer; import com.threerings.media.timer.NanoTimer; +import static com.threerings.media.Log.log; + /** * Provides a simple mechanism for monitoring the number of times an action takes place within a * certain time period. @@ -78,7 +79,7 @@ public class PerformanceMonitor // get the observer's action hashtable HashMap actions = (HashMap)_observers.get(obs); if (actions == null) { - Log.warning("Attempt to unregister by unknown observer " + + log.warning("Attempt to unregister by unknown observer " + "[observer=" + obs + ", name=" + name + "]."); return; } @@ -86,7 +87,7 @@ public class PerformanceMonitor // attempt to remove the specified action PerformanceAction action = (PerformanceAction)actions.remove(name); if (action == null) { - Log.warning("Attempt to unregister unknown action " + + log.warning("Attempt to unregister unknown action " + "[observer=" + obs + ", name=" + name + "]."); return; } @@ -109,7 +110,7 @@ public class PerformanceMonitor // get the observer's action hashtable HashMap actions = (HashMap)_observers.get(obs); if (actions == null) { - Log.warning("Attempt to tick by unknown observer " + + log.warning("Attempt to tick by unknown observer " + "[observer=" + obs + ", name=" + name + "]."); return; } @@ -117,7 +118,7 @@ public class PerformanceMonitor // get the specified action PerformanceAction action = (PerformanceAction)actions.get(name); if (action == null) { - Log.warning("Attempt to tick unknown value " + + log.warning("Attempt to tick unknown value " + "[observer=" + obs + ", name=" + name + "]."); return; } diff --git a/src/java/com/threerings/media/util/TimedPath.java b/src/java/com/threerings/media/util/TimedPath.java index a990c7b5..3a0d5df9 100644 --- a/src/java/com/threerings/media/util/TimedPath.java +++ b/src/java/com/threerings/media/util/TimedPath.java @@ -21,7 +21,7 @@ package com.threerings.media.util; -import com.threerings.media.Log; +import static com.threerings.media.Log.log; /** * A base class for path implementations that endeavor to move their @@ -37,7 +37,7 @@ public abstract class TimedPath implements Path { // sanity check some things if (duration <= 0) { - Log.warning("Requested path with illegal duration (<=0) " + + log.warning("Requested path with illegal duration (<=0) " + "[duration=" + duration + "]"); Thread.dumpStack(); duration = 1; // assume something short but non-zero diff --git a/src/java/com/threerings/miso/Log.java b/src/java/com/threerings/miso/Log.java index 1011d140..f7a46a76 100644 --- a/src/java/com/threerings/miso/Log.java +++ b/src/java/com/threerings/miso/Log.java @@ -21,36 +21,12 @@ package com.threerings.miso; +import com.samskivert.util.Logger; + /** - * A placeholder class that contains a reference to the log object used by - * the miso package. + * Contains a reference to the log object used by the Miso package. */ public class Log { - public static com.samskivert.util.Log log = - new com.samskivert.util.Log("miso"); - - /** 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.miso"); } diff --git a/src/java/com/threerings/miso/client/DirtyItemList.java b/src/java/com/threerings/miso/client/DirtyItemList.java index b684dd8e..327116b5 100644 --- a/src/java/com/threerings/miso/client/DirtyItemList.java +++ b/src/java/com/threerings/miso/client/DirtyItemList.java @@ -27,10 +27,11 @@ import java.util.Comparator; import com.samskivert.util.SortableArrayList; -import com.threerings.media.Log; import com.threerings.media.sprite.Sprite; import com.threerings.media.tile.ObjectTile; +import static com.threerings.media.Log.log; + /** * The dirty item list keeps track of dirty sprites and object tiles * in a scene. @@ -90,7 +91,7 @@ public class DirtyItemList int size = size(); if (DEBUG_SORT) { - Log.info("Sorting dirty item list [size=" + size + "]."); + log.info("Sorting dirty item list [size=" + size + "]."); } // if we've only got one item, we need to do no sorting @@ -99,7 +100,7 @@ public class DirtyItemList _xitems.addAll(_items); _xitems.sort(ORIGIN_X_COMP); if (DEBUG_SORT) { - Log.info("Sorted by x-origin " + + log.info("Sorted by x-origin " + "[items=" + toString(_xitems) + "]."); } @@ -107,7 +108,7 @@ public class DirtyItemList _yitems.addAll(_items); _yitems.sort(ORIGIN_Y_COMP); if (DEBUG_SORT) { - Log.info("Sorted by y-origin " + + log.info("Sorted by y-origin " + "[items=" + toString(_yitems) + "]."); } @@ -142,12 +143,12 @@ public class DirtyItemList } if (DEBUG_SORT) { - Log.info("Sorted for render [items=" + toString(_items) + "]."); + log.info("Sorted for render [items=" + toString(_items) + "]."); for (int ii = 0, ll = _items.size()-1; ii < ll; ii++) { DirtyItem a = (DirtyItem)_items.get(ii); DirtyItem b = (DirtyItem)_items.get(ii+1); if (_rcomp.compare(a, b) > 0) { - Log.warning("Invalid ordering [a=" + a + ", b=" + b + "]."); + log.warning("Invalid ordering [a=" + a + ", b=" + b + "]."); } } } @@ -444,7 +445,7 @@ public class DirtyItemList int result = soa.getPriority() - sob.getPriority(); if (DEBUG_COMPARE) { String items = DirtyItemList.toString(da, db); - Log.info("compare: overlapping [result=" + result + + log.info("compare: overlapping [result=" + result + ", items=" + items + "]."); } return result; @@ -456,7 +457,7 @@ public class DirtyItemList if (result != 0) { if (DEBUG_COMPARE) { String items = DirtyItemList.toString(da, db); - Log.info("compare: Y-partitioned " + + log.info("compare: Y-partitioned " + "[result=" + result + ", items=" + items + "]."); } return result; @@ -467,7 +468,7 @@ public class DirtyItemList if (result != 0) { if (DEBUG_COMPARE) { String items = DirtyItemList.toString(da, db); - Log.info("compare: X-partitioned " + + log.info("compare: X-partitioned " + "[result=" + result + ", items=" + items + "]."); } return result; @@ -477,7 +478,7 @@ public class DirtyItemList result = compareNonPartitioned(da, db); if (DEBUG_COMPARE) { String items = DirtyItemList.toString(da, db); - Log.info("compare: non-partitioned " + + log.info("compare: non-partitioned " + "[result=" + result + ", items=" + items + "]."); } diff --git a/src/java/com/threerings/miso/client/MisoScenePanel.java b/src/java/com/threerings/miso/client/MisoScenePanel.java index a5b05d0a..8a3956ba 100644 --- a/src/java/com/threerings/miso/client/MisoScenePanel.java +++ b/src/java/com/threerings/miso/client/MisoScenePanel.java @@ -69,7 +69,6 @@ import com.threerings.media.tile.TileSet; import com.threerings.media.util.AStarPathUtil; import com.threerings.media.util.MathUtil; import com.threerings.media.util.Path; -import com.threerings.miso.Log; import com.threerings.miso.MisoPrefs; import com.threerings.miso.client.DirtyItemList.DirtyItem; import com.threerings.miso.data.MisoSceneModel; @@ -79,6 +78,8 @@ import com.threerings.miso.util.MisoContext; import com.threerings.miso.util.MisoSceneMetrics; import com.threerings.miso.util.MisoUtil; +import static com.threerings.miso.Log.log; + /** * Renders a Miso scene for all to see. */ @@ -304,7 +305,7 @@ public class MisoScenePanel extends VirtualMediaPanel // an eye out for bogosity if (duration > 500L) { int considered = AStarPathUtil.getConsidered(); - Log.warning("Considered " + considered + " nodes for path from " + + log.warning("Considered " + considered + " nodes for path from " + StringUtil.toString(src) + " to " + StringUtil.toString(dest) + " [duration=" + duration + "]."); @@ -362,7 +363,7 @@ public class MisoScenePanel extends VirtualMediaPanel for (SceneBlock block : _blocks.values()) { block.computeMemoryUsage(base, fringe, object, usage); } - Log.info("Scene tile memory usage " + + log.info("Scene tile memory usage " + "[scene=" + StringUtil.shortClassName(this) + ", base=" + base.size() + "->" + (usage[0] / 1024) + "k" + ", fringe=" + fringe.size() + "->" + (usage[1] / 1024) + "k" + @@ -739,7 +740,7 @@ public class MisoScenePanel extends VirtualMediaPanel _ulpos.setLocation(_tcoords); if (rethink() > 0) { _delayRepaint = mightDelayPaint; - Log.info("Got new pending blocks " + + log.info("Got new pending blocks " + "[need=" + _visiBlocks.size() + ", of=" + _pendingBlocks + ", view=" + StringUtil.toString(_vbounds) + @@ -813,7 +814,7 @@ public class MisoScenePanel extends VirtualMediaPanel key.x = block.getBounds().x; key.y = block.getBounds().y; if (!_rethinkOp.blocks.contains(key)) { - Log.debug("Flushing block " + block + "."); + log.debug("Flushing block " + block + "."); if (_dpanel != null) { _dpanel.blockCleared(block); } @@ -848,7 +849,7 @@ public class MisoScenePanel extends VirtualMediaPanel // recompute our visible object set recomputeVisible(); - Log.debug("Rethunk [pending=" + _pendingBlocks + ", visible=" + _visiBlocks.size() + "]."); + log.debug("Rethunk [pending=" + _pendingBlocks + ", visible=" + _visiBlocks.size() + "]."); return _visiBlocks.size(); } @@ -950,7 +951,7 @@ public class MisoScenePanel extends VirtualMediaPanel // resolution, recompute our visible object set and show ourselves if (_visiBlocks.remove(block) && _visiBlocks.size() == 0) { recomputeVisible(); - Log.info("Restoring repaint... [left=" + _pendingBlocks + + log.info("Restoring repaint... [left=" + _pendingBlocks + ", view=" + StringUtil.toString(_vbounds) + "]."); _delayRepaint = false; _remgr.invalidateRegion(_vbounds); @@ -964,7 +965,7 @@ public class MisoScenePanel extends VirtualMediaPanel */ protected void warnVisible (SceneBlock block, Rectangle sbounds) { - Log.warning("Block visible during resolution " + block + + log.warning("Block visible during resolution " + block + " sbounds:" + StringUtil.toString(sbounds) + " vbounds:" + StringUtil.toString(_vbounds) + "."); } @@ -1556,7 +1557,7 @@ public class MisoScenePanel extends VirtualMediaPanel } } catch (ArrayIndexOutOfBoundsException e) { - Log.warning("Whoops, booched it [tx=" + tx + + log.warning("Whoops, booched it [tx=" + tx + ", ty=" + ty + ", tb.x=" + tbounds.x + "]."); e.printStackTrace(System.err); } diff --git a/src/java/com/threerings/miso/client/ObjectActionHandler.java b/src/java/com/threerings/miso/client/ObjectActionHandler.java index 3918b41a..ed66aefc 100644 --- a/src/java/com/threerings/miso/client/ObjectActionHandler.java +++ b/src/java/com/threerings/miso/client/ObjectActionHandler.java @@ -28,9 +28,10 @@ import javax.swing.Icon; import com.samskivert.swing.RadialMenu; import com.samskivert.util.StringUtil; -import com.threerings.miso.Log; import com.threerings.miso.client.SceneObject; +import static com.threerings.miso.Log.log; + /** * Objects in scenes can be configured to generate action events. Those * events are grouped into types and an object action handler can be @@ -88,7 +89,7 @@ public class ObjectActionHandler */ public void handleAction (SceneObject scobj, ActionEvent event) { - Log.warning("Unknown object action [scobj=" + scobj + + log.warning("Unknown object action [scobj=" + scobj + ", action=" + event + "]."); } @@ -138,7 +139,7 @@ public class ObjectActionHandler { // make sure we know about potential funny business if (_oahandlers.containsKey(prefix)) { - Log.warning("Warning! Overwriting previous object action " + + log.warning("Warning! Overwriting previous object action " + "handler registration, all hell could shortly " + "break loose [prefix=" + prefix + ", handler=" + handler + "]."); diff --git a/src/java/com/threerings/miso/client/SceneBlock.java b/src/java/com/threerings/miso/client/SceneBlock.java index fdd4b1ef..b6d78775 100644 --- a/src/java/com/threerings/miso/client/SceneBlock.java +++ b/src/java/com/threerings/miso/client/SceneBlock.java @@ -40,13 +40,14 @@ import com.threerings.media.tile.TileSet; import com.threerings.media.tile.TileUtil; import com.threerings.media.util.MathUtil; -import com.threerings.miso.Log; import com.threerings.miso.data.MisoSceneModel; import com.threerings.miso.data.ObjectInfo; import com.threerings.miso.tile.BaseTile; import com.threerings.miso.util.MisoUtil; import com.threerings.miso.util.ObjectSet; +import static com.threerings.miso.Log.log; + /** * Contains the base and object tile information on a particular * rectangular region of a scene. @@ -133,7 +134,7 @@ public class SceneBlock long stamp = System.currentTimeMillis(); long elapsed = stamp - now; if (elapsed > 500L) { - Log.warning("Base and fringe resolution took long time " + + log.warning("Base and fringe resolution took long time " + "[block=" + this + ", baseCount=" + baseCount + ", fringeCount=" + fringeCount + ", elapsed=" + elapsed + "]."); @@ -159,7 +160,7 @@ public class SceneBlock elapsed = stamp - now; now = stamp; if (elapsed > 250L) { - Log.warning("Scene object took look time to resolve " + + log.warning("Scene object took look time to resolve " + "[block=" + this + ", scobj=" + scobj + ", elapsed=" + elapsed + "]."); } @@ -173,7 +174,7 @@ public class SceneBlock _defset = _panel.getTileManager().getTileSet(bsetid); } } catch (Exception e) { - Log.warning("Unable to fetch default base tileset [tsid=" + bsetid + + log.warning("Unable to fetch default base tileset [tsid=" + bsetid + ", error=" + e + "]."); } @@ -304,7 +305,7 @@ public class SceneBlock } if (errmsg != null) { - Log.warning(errmsg + " [fqtid=" + fqTileId + + log.warning(errmsg + " [fqtid=" + fqTileId + ", x=" + tx + ", y=" + ty + "]."); } } @@ -421,7 +422,7 @@ public class SceneBlock bases.put(base.key, base); usage[0] += base.getEstimatedMemoryUsage(); } else if (base != _base[tidx]) { - Log.warning("Multiple instances of same base tile " + + log.warning("Multiple instances of same base tile " + "[base=" + base + ", x=" + xx + ", y=" + yy + "]."); usage[0] += base.getEstimatedMemoryUsage(); @@ -446,7 +447,7 @@ public class SceneBlock objects.put(scobj.tile.key, scobj.tile); usage[2] += scobj.tile.getEstimatedMemoryUsage(); } else if (tile != scobj.tile) { - Log.warning("Multiple instances of same object tile: " + + log.warning("Multiple instances of same object tile: " + scobj.info + "."); usage[2] += scobj.tile.getEstimatedMemoryUsage(); } diff --git a/src/java/com/threerings/miso/client/SceneBlockResolver.java b/src/java/com/threerings/miso/client/SceneBlockResolver.java index db59e1bf..056967da 100644 --- a/src/java/com/threerings/miso/client/SceneBlockResolver.java +++ b/src/java/com/threerings/miso/client/SceneBlockResolver.java @@ -27,7 +27,7 @@ import com.samskivert.util.Histogram; import com.samskivert.util.LoopingThread; import com.samskivert.util.Queue; -import com.threerings.miso.Log; +import static com.threerings.miso.Log.log; /** * A separate thread for resolving miso scene blocks. @@ -39,7 +39,7 @@ public class SceneBlockResolver extends LoopingThread */ public void resolveBlock (SceneBlock block, boolean hipri) { - Log.debug("Queueing block for resolution " + block + + log.debug("Queueing block for resolution " + block + " (" + hipri + ")."); if (hipri) { _queue.prepend(block); @@ -84,23 +84,23 @@ public class SceneBlockResolver extends LoopingThread try { wait(); } catch (InterruptedException ie) { - Log.info("Resolver interrupted."); + log.info("Resolver interrupted."); } } } try { long start = System.currentTimeMillis(); - Log.debug("Resolving block " + block + "."); + log.debug("Resolving block " + block + "."); if (block.resolve()) { - Log.debug("Resolved block " + block + "."); + log.debug("Resolved block " + block + "."); } long elapsed = System.currentTimeMillis() - start; _histo.addValue((int)elapsed); // warn if a block takes a long time to resolve if (elapsed > LONG_RESOLVE_TIME) { - Log.warning("Block took long time to resolve [block=" + block + + log.warning("Block took long time to resolve [block=" + block + ", elapsed=" + elapsed + "ms]."); } @@ -119,8 +119,7 @@ public class SceneBlockResolver extends LoopingThread }); } catch (Exception e) { - Log.warning("Block failed during resolution " + block + "."); - Log.logStackTrace(e); + log.warning("Block failed during resolution " + block + ".", e); } } diff --git a/src/java/com/threerings/miso/client/SceneObject.java b/src/java/com/threerings/miso/client/SceneObject.java index e3bed9d0..8d6fcb6c 100644 --- a/src/java/com/threerings/miso/client/SceneObject.java +++ b/src/java/com/threerings/miso/client/SceneObject.java @@ -36,12 +36,13 @@ import com.threerings.media.tile.NoSuchTileSetException; import com.threerings.media.tile.ObjectTile; import com.threerings.media.tile.TileUtil; -import com.threerings.miso.Log; import com.threerings.miso.MisoPrefs; import com.threerings.miso.data.ObjectInfo; import com.threerings.miso.util.MisoSceneMetrics; import com.threerings.miso.util.MisoUtil; +import static com.threerings.miso.Log.log; + /** * Contains resolved information on an object in a scene. */ @@ -256,7 +257,7 @@ public class SceneObject computeInfo(panel.getSceneMetrics()); } catch (NoSuchTileSetException te) { - Log.warning("Scene contains non-existent object tileset " + + log.warning("Scene contains non-existent object tileset " + "[info=" + info + "]."); } } diff --git a/src/java/com/threerings/miso/data/SparseMisoSceneModel.java b/src/java/com/threerings/miso/data/SparseMisoSceneModel.java index b9196036..05d24757 100644 --- a/src/java/com/threerings/miso/data/SparseMisoSceneModel.java +++ b/src/java/com/threerings/miso/data/SparseMisoSceneModel.java @@ -34,9 +34,10 @@ import com.threerings.io.SimpleStreamableObject; import com.threerings.media.util.MathUtil; import com.threerings.util.StreamableHashIntMap; -import com.threerings.miso.Log; import com.threerings.miso.util.ObjectSet; +import static com.threerings.miso.Log.log; + /** * Contains miso scene data that is broken up into NxN tile sections. */ @@ -103,7 +104,7 @@ public class SparseMisoSceneModel extends MisoSceneModel public int getBaseTileId (int col, int row) { if (col < x || col >= (x+width) || row < y || row >= (y+width)) { - Log.warning("Requested bogus tile +" + col + "+" + row + + log.warning("Requested bogus tile +" + col + "+" + row + " from " + this + "."); return -1; } else { @@ -120,12 +121,12 @@ public class SparseMisoSceneModel extends MisoSceneModel // type at these coordinates int dupidx; if ((dupidx = ListUtil.indexOf(objectInfo, info)) != -1) { - Log.warning("Refusing to add duplicate object [ninfo=" + info + + log.warning("Refusing to add duplicate object [ninfo=" + info + ", oinfo=" + objectInfo[dupidx] + "]."); return false; } if ((dupidx = indexOfUn(info)) != -1) { - Log.warning("Refusing to add duplicate object " + + log.warning("Refusing to add duplicate object " + "[info=" + info + "]."); return false; } diff --git a/src/java/com/threerings/miso/tile/AutoFringer.java b/src/java/com/threerings/miso/tile/AutoFringer.java index 578165ae..813706ff 100644 --- a/src/java/com/threerings/miso/tile/AutoFringer.java +++ b/src/java/com/threerings/miso/tile/AutoFringer.java @@ -40,9 +40,10 @@ import com.threerings.media.tile.TileManager; import com.threerings.media.tile.TileSet; import com.threerings.media.tile.TileUtil; -import com.threerings.miso.Log; import com.threerings.miso.data.MisoSceneModel; +import static com.threerings.miso.Log.log; + /** * Automatically fringes a scene according to the rules in the supplied fringe configuration. */ @@ -116,7 +117,7 @@ public class AutoFringer BaseTile bt = (BaseTile) _tmgr.getTile(btid); passable = bt.isPassable(); } catch (NoSuchTileSetException nstse) { - Log.warning("Autofringer couldn't find a base " + + log.warning("Autofringer couldn't find a base " + "set while attempting to figure passability " + "[error=" + nstse + "]."); } @@ -160,7 +161,7 @@ public class AutoFringer try { ftimg = getTileImage(ftimg, fringers[ii].baseset, indexes[jj], masks, hashValue); } catch (NoSuchTileSetException nstse) { - Log.warning("Autofringer couldn't find a needed tileset [error=" + nstse + "]."); + log.warning("Autofringer couldn't find a needed tileset [error=" + nstse + "]."); } } } diff --git a/src/java/com/threerings/miso/tile/MisoTileManager.java b/src/java/com/threerings/miso/tile/MisoTileManager.java index 256194b4..7409faae 100644 --- a/src/java/com/threerings/miso/tile/MisoTileManager.java +++ b/src/java/com/threerings/miso/tile/MisoTileManager.java @@ -32,7 +32,7 @@ import com.threerings.util.CompiledConfig; import com.threerings.media.image.ImageManager; import com.threerings.media.tile.TileManager; -import com.threerings.miso.Log; +import static com.threerings.miso.Log.log; /** * Extends the basic tile manager and provides support for automatically @@ -62,7 +62,7 @@ public class MisoTileManager extends TileManager _fringer = new AutoFringer(config, imgr, this); } catch (IOException ioe) { - Log.warning("Unable to load fringe configuration " + + log.warning("Unable to load fringe configuration " + "[path=" + FRINGE_CONFIG_PATH + ", error=" + ioe + "]."); diff --git a/src/java/com/threerings/miso/tile/tools/xml/BaseTileSetRuleSet.java b/src/java/com/threerings/miso/tile/tools/xml/BaseTileSetRuleSet.java index 070d87ad..6ee5ce75 100644 --- a/src/java/com/threerings/miso/tile/tools/xml/BaseTileSetRuleSet.java +++ b/src/java/com/threerings/miso/tile/tools/xml/BaseTileSetRuleSet.java @@ -28,9 +28,10 @@ import com.samskivert.xml.CallMethodSpecialRule; import com.threerings.media.tile.tools.xml.SwissArmyTileSetRuleSet; -import com.threerings.miso.Log; import com.threerings.miso.tile.BaseTileSet; +import static com.threerings.miso.Log.log; + /** * Parses {@link BaseTileSet} instances from a tileset description. Base * tilesets extend swiss army tilesets with the addition of a passability @@ -66,7 +67,7 @@ public class BaseTileSetRuleSet extends SwissArmyTileSetRuleSet // check for a element if (set.getPassability() == null) { - Log.warning("Tile set definition missing valid " + + log.warning("Tile set definition missing valid " + "element [set=" + set + "]."); valid = false; } diff --git a/src/java/com/threerings/miso/tile/tools/xml/FringeConfigurationParser.java b/src/java/com/threerings/miso/tile/tools/xml/FringeConfigurationParser.java index 57a7a9ec..c86d6764 100644 --- a/src/java/com/threerings/miso/tile/tools/xml/FringeConfigurationParser.java +++ b/src/java/com/threerings/miso/tile/tools/xml/FringeConfigurationParser.java @@ -34,11 +34,12 @@ import com.threerings.tools.xml.CompiledConfigParser; import com.threerings.media.tile.TileSetIDBroker; -import com.threerings.miso.Log; import com.threerings.miso.tile.FringeConfiguration.FringeRecord; import com.threerings.miso.tile.FringeConfiguration.FringeTileSetRecord; import com.threerings.miso.tile.FringeConfiguration; +import static com.threerings.miso.Log.log; + /** * Parses fringe config definitions. */ @@ -73,7 +74,7 @@ public class FringeConfigurationParser extends CompiledConfigParser if (((FringeRecord) target).isValid()) { return true; } else { - Log.warning("A FringeRecord was not added because it was " + + log.warning("A FringeRecord was not added because it was " + "improperly specified [rec=" + target + "]."); return false; } @@ -99,14 +100,14 @@ public class FringeConfigurationParser extends CompiledConfigParser if (_idBroker.tileSetMapped(value)) { frec.base_tsid = _idBroker.getTileSetID(value); } else { - Log.warning("Skipping unknown base " + + log.warning("Skipping unknown base " + "tileset [name=" + value + "]."); } } else if ("priority".equals(name)) { frec.priority = Integer.parseInt(value); } else { - Log.warning("Skipping unknown attribute " + + log.warning("Skipping unknown attribute " + "[name=" + name + "]."); } } @@ -123,7 +124,7 @@ public class FringeConfigurationParser extends CompiledConfigParser if (((FringeTileSetRecord) target).isValid()) { return true; } else { - Log.warning("A FringeTileSetRecord was not added because " + + log.warning("A FringeTileSetRecord was not added because " + "it was improperly specified " + "[rec=" + target + "]."); return false; @@ -148,14 +149,14 @@ public class FringeConfigurationParser extends CompiledConfigParser if (_idBroker.tileSetMapped(value)) { f.fringe_tsid = _idBroker.getTileSetID(value); } else { - Log.warning("Skipping unknown fringe " + + log.warning("Skipping unknown fringe " + "tileset [name=" + value + "]."); } } else if ("mask".equals(name)) { f.mask = Boolean.valueOf(value).booleanValue(); } else { - Log.warning("Skipping unknown attribute " + + log.warning("Skipping unknown attribute " + "[name=" + name + "]."); } } diff --git a/src/java/com/threerings/miso/util/ObjectSet.java b/src/java/com/threerings/miso/util/ObjectSet.java index 491fea2e..ef77a03c 100644 --- a/src/java/com/threerings/miso/util/ObjectSet.java +++ b/src/java/com/threerings/miso/util/ObjectSet.java @@ -27,9 +27,10 @@ import java.util.Comparator; import com.samskivert.util.ArrayUtil; import com.samskivert.util.ListUtil; -import com.threerings.miso.Log; import com.threerings.miso.data.ObjectInfo; +import static com.threerings.miso.Log.log; + /** * Used to store an (arbitrarily) ordered, low-impact iteratable (doesn't * require object creation), set of {@link ObjectInfo} instances. @@ -48,7 +49,7 @@ public class ObjectSet int ipos = indexOf(info); if (ipos >= 0) { // log a warning because the caller shouldn't be doing this - Log.warning("Requested to add an object to a set that already " + + log.warning("Requested to add an object to a set that already " + "contains such an object [ninfo=" + info + ", oinfo=" + _objs[ipos] + "]."); Thread.dumpStack(); diff --git a/src/java/com/threerings/openal/ClipBuffer.java b/src/java/com/threerings/openal/ClipBuffer.java index 101a9282..8e23194e 100644 --- a/src/java/com/threerings/openal/ClipBuffer.java +++ b/src/java/com/threerings/openal/ClipBuffer.java @@ -29,6 +29,8 @@ import org.lwjgl.openal.AL10; import com.samskivert.util.ObserverList; +import static com.threerings.openal.Log.log; + /** * Represents a sound that has been loaded into the OpenAL system. */ @@ -154,7 +156,7 @@ public class ClipBuffer AL10.alGenBuffers(_bufferId); int errno = AL10.alGetError(); if (errno != AL10.AL_NO_ERROR) { - Log.warning("Failed to create buffer [key=" + getKey() + + log.warning("Failed to create buffer [key=" + getKey() + ", errno=" + errno + "]."); _bufferId = null; // queue up a failure notification so that we properly return @@ -211,7 +213,7 @@ public class ClipBuffer _bufferId.get(0), clip.format, clip.data, clip.frequency); int errno = AL10.alGetError(); if (errno != AL10.AL_NO_ERROR) { - Log.warning("Failed to bind clip [key=" + getKey() + + log.warning("Failed to bind clip [key=" + getKey() + ", errno=" + errno + "]."); failed(); return false; diff --git a/src/java/com/threerings/openal/Log.java b/src/java/com/threerings/openal/Log.java index 925c01e9..c4a4e67b 100644 --- a/src/java/com/threerings/openal/Log.java +++ b/src/java/com/threerings/openal/Log.java @@ -21,36 +21,12 @@ package com.threerings.openal; +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("narya.openal"); - - /** 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.openal"); } diff --git a/src/java/com/threerings/openal/SoundGroup.java b/src/java/com/threerings/openal/SoundGroup.java index 3edf8a72..75026105 100644 --- a/src/java/com/threerings/openal/SoundGroup.java +++ b/src/java/com/threerings/openal/SoundGroup.java @@ -27,6 +27,8 @@ import java.util.ArrayList; import org.lwjgl.BufferUtils; import org.lwjgl.openal.AL10; +import static com.threerings.openal.Log.log; + /** * Manages a group of sounds, binding them to OpenAL sources as they are * played and freeing up those sources for use by other sounds when the @@ -107,7 +109,7 @@ public class SoundGroup AL10.alGenSources(_sourceIds); int errno = AL10.alGetError(); if (errno != AL10.AL_NO_ERROR) { - Log.warning("Failed to create sources [cprov=" + provider + + log.warning("Failed to create sources [cprov=" + provider + ", sources=" + sources + ", errno=" + errno + "]."); _sourceIds = null; // we'll have no sources which means all requests to play diff --git a/src/java/com/threerings/openal/SoundManager.java b/src/java/com/threerings/openal/SoundManager.java index 4145dde4..7ee1ddf6 100644 --- a/src/java/com/threerings/openal/SoundManager.java +++ b/src/java/com/threerings/openal/SoundManager.java @@ -33,6 +33,8 @@ import com.samskivert.util.LRUHashMap; import com.samskivert.util.Queue; import com.samskivert.util.RunQueue; +import static com.threerings.openal.Log.log; + /** * An interface to the OpenAL library that provides a number of additional services: * @@ -155,15 +157,14 @@ public class SoundManager try { AL.create("", 44100, 15, false); } catch (Exception e) { - Log.warning("Failed to initialize sound system."); - Log.logStackTrace(e); + log.warning("Failed to initialize sound system.", e); // don't start the background loading thread return; } int errno = AL10.alGetError(); if (errno != AL10.AL_NO_ERROR) { - Log.warning("Failed to initialize sound system [errno=" + errno + "]."); + log.warning("Failed to initialize sound system [errno=" + errno + "]."); // don't start the background loading thread return; } @@ -174,7 +175,7 @@ public class SoundManager final ClipBuffer item) { _rqueue.postRunnable(new Runnable() { public void run () { - Log.debug("Flushing " + item.getKey()); + log.debug("Flushing " + item.getKey()); item.dispose(); } }); @@ -211,8 +212,7 @@ public class SoundManager return buffer; } catch (Throwable t) { - Log.warning("Failure resolving buffer [key=" + ckey + "]."); - Log.logStackTrace(t); + log.warning("Failure resolving buffer [key=" + ckey + "].", t); return null; } } @@ -275,12 +275,12 @@ public class SoundManager while (true) { final ClipBuffer buffer = (ClipBuffer)_toLoad.get(); try { - Log.debug("Loading " + buffer.getKey() + "."); + log.debug("Loading " + buffer.getKey() + "."); final Clip clip = buffer.load(); _rqueue.postRunnable(new Runnable() { public void run () { Comparable ckey = buffer.getKey(); - Log.debug("Loaded " + ckey + "."); + log.debug("Loaded " + ckey + "."); _loading.remove(ckey); if (buffer.bind(clip)) { _clips.put(ckey, buffer); @@ -292,8 +292,7 @@ public class SoundManager }); } catch (Throwable t) { - Log.warning("Failed to load clip [key=" + buffer.getKey() + "]."); - Log.logStackTrace(t); + log.warning("Failed to load clip [key=" + buffer.getKey() + "].", t); // let the clip and its observers know that we are a miserable failure queueClipFailure(buffer); diff --git a/src/java/com/threerings/openal/Stream.java b/src/java/com/threerings/openal/Stream.java index 3d1f0d30..d5c58d2c 100644 --- a/src/java/com/threerings/openal/Stream.java +++ b/src/java/com/threerings/openal/Stream.java @@ -30,6 +30,8 @@ import java.nio.IntBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.openal.AL10; +import static com.threerings.openal.Log.log; + /** * Represents a streaming source of sound data. */ @@ -91,7 +93,7 @@ public abstract class Stream public void play () { if (_state == AL10.AL_PLAYING) { - Log.warning("Tried to play stream already playing."); + log.warning("Tried to play stream already playing."); return; } if (_state == AL10.AL_INITIAL) { @@ -108,7 +110,7 @@ public abstract class Stream public void pause () { if (_state != AL10.AL_PLAYING) { - Log.warning("Tried to pause stream that wasn't playing."); + log.warning("Tried to pause stream that wasn't playing."); return; } AL10.alSourcePause(_sourceId); @@ -121,7 +123,7 @@ public abstract class Stream public void stop () { if (_state == AL10.AL_STOPPED) { - Log.warning("Tried to stop stream that was already stopped."); + log.warning("Tried to stop stream that was already stopped."); return; } AL10.alSourceStop(_sourceId); @@ -271,7 +273,7 @@ public abstract class Stream try { read = Math.max(populateBuffer(_abuf), 0); } catch (IOException e) { - Log.warning("Error reading audio stream [error=" + e + "]."); + log.warning("Error reading audio stream [error=" + e + "]."); } if (read <= 0) { return false; diff --git a/src/java/com/threerings/openal/StreamDecoder.java b/src/java/com/threerings/openal/StreamDecoder.java index 9a37f337..329e9eac 100644 --- a/src/java/com/threerings/openal/StreamDecoder.java +++ b/src/java/com/threerings/openal/StreamDecoder.java @@ -30,6 +30,8 @@ import java.io.InputStream; import java.nio.ByteBuffer; +import static com.threerings.openal.Log.log; + /** * Decodes audio streams from data read from an {@link InputStream}. */ @@ -52,13 +54,13 @@ public abstract class StreamDecoder String path = file.getPath(); int idx = path.lastIndexOf('.'); if (idx == -1) { - Log.warning("Missing extension for file [file=" + path + "]."); + log.warning("Missing extension for file [file=" + path + "]."); return null; } String extension = path.substring(idx+1); Class clazz = _extensions.get(extension); if (clazz == null) { - Log.warning("No decoder registered for extension [extension=" + extension + + log.warning("No decoder registered for extension [extension=" + extension + ", file=" + path + "]."); return null; } @@ -66,7 +68,7 @@ public abstract class StreamDecoder try { decoder = (StreamDecoder)clazz.newInstance(); } catch (Exception e) { - Log.warning("Error instantiating decoder [file=" + path + ", error=" + e + "]."); + log.warning("Error instantiating decoder [file=" + path + ", error=" + e + "]."); return null; } decoder.init(new FileInputStream(file)); diff --git a/src/java/com/threerings/resource/FileResourceBundle.java b/src/java/com/threerings/resource/FileResourceBundle.java index b5fc403a..76b2e970 100644 --- a/src/java/com/threerings/resource/FileResourceBundle.java +++ b/src/java/com/threerings/resource/FileResourceBundle.java @@ -38,6 +38,8 @@ import com.samskivert.util.StringUtil; import org.apache.commons.io.IOUtils; +import static com.threerings.resource.Log.log; + /** * A resource bundle provides access to the resources in a jar file. */ @@ -135,16 +137,16 @@ public class FileResourceBundle extends ResourceBundle try { resolveJarFile(); } catch (IOException ioe) { - Log.warning("Failure resolving jar file '" + _source + + log.warning("Failure resolving jar file '" + _source + "': " + ioe + "."); wipeBundle(true); return false; } - Log.info("Unpacking into " + _cache + "..."); + log.info("Unpacking into " + _cache + "..."); if (!_cache.exists()) { if (!_cache.mkdir()) { - Log.warning("Failed to create bundle cache directory '" + + log.warning("Failed to create bundle cache directory '" + _cache + "'."); closeJar(); // we are hopelessly fucked @@ -166,11 +168,11 @@ public class FileResourceBundle extends ResourceBundle try { _unpacked.createNewFile(); if (!_unpacked.setLastModified(_sourceLastMod)) { - Log.warning("Failed to set last mod on stamp file '" + + log.warning("Failed to set last mod on stamp file '" + _unpacked + "'."); } } catch (IOException ioe) { - Log.warning("Failure creating stamp file '" + _unpacked + + log.warning("Failure creating stamp file '" + _unpacked + "': " + ioe + "."); // no need to stick a fork in things at this point } @@ -200,14 +202,14 @@ public class FileResourceBundle extends ResourceBundle // that we ensure that it is revalidated File vfile = new File(FileUtil.resuffix(_source, ".jar", ".jarv")); if (vfile.exists() && !vfile.delete()) { - Log.warning("Failed to delete " + vfile + "."); + log.warning("Failed to delete " + vfile + "."); } // close and delete our source jar file if (deleteJar && _source != null) { closeJar(); if (!_source.delete()) { - Log.warning("Failed to delete " + _source + + log.warning("Failed to delete " + _source + " [exists=" + _source.exists() + "]."); } } @@ -329,8 +331,7 @@ public class FileResourceBundle extends ResourceBundle } catch (IOException ioe) { String msg = "Failed to resolve resource bundle jar file '" + _source + "'"; - Log.warning(msg + "."); - Log.logStackTrace(ioe); + log.warning(msg + ".", ioe); throw (IOException) new IOException(msg).initCause(ioe); } } @@ -345,7 +346,7 @@ public class FileResourceBundle extends ResourceBundle _jarSource.close(); } } catch (Exception ioe) { - Log.warning("Failed to close jar file [path=" + _source + + log.warning("Failed to close jar file [path=" + _source + ", error=" + ioe + "]."); } } @@ -358,7 +359,7 @@ public class FileResourceBundle extends ResourceBundle if (_tmpdir == null) { String tmpdir = System.getProperty("java.io.tmpdir"); if (tmpdir == null) { - Log.info("No system defined temp directory. Faking it."); + log.info("No system defined temp directory. Faking it."); tmpdir = System.getProperty("user.home"); } setCacheDir(new File(tmpdir)); @@ -375,16 +376,16 @@ public class FileResourceBundle extends ResourceBundle _tmpdir = new File(tmpdir, "narcache_" + rando); if (!_tmpdir.exists()) { if (_tmpdir.mkdirs()) { - Log.debug("Created narya temp cache directory '" + _tmpdir + "'."); + log.debug("Created narya temp cache directory '" + _tmpdir + "'."); } else { - Log.warning("Failed to create temp cache directory '" + _tmpdir + "'."); + log.warning("Failed to create temp cache directory '" + _tmpdir + "'."); } } // add a hook to blow away the temp directory when we exit Runtime.getRuntime().addShutdownHook(new Thread() { public void run () { - Log.info("Clearing narya temp cache '" + _tmpdir + "'."); + log.info("Clearing narya temp cache '" + _tmpdir + "'."); FileUtil.recursiveDelete(_tmpdir); } }); diff --git a/src/java/com/threerings/resource/Handler.java b/src/java/com/threerings/resource/Handler.java index 3898b524..a185bcee 100644 --- a/src/java/com/threerings/resource/Handler.java +++ b/src/java/com/threerings/resource/Handler.java @@ -43,6 +43,8 @@ import com.samskivert.util.StringUtil; import com.threerings.geom.GeomUtil; +import static com.threerings.resource.Log.log; + /** * This class is not used directly, except by a registering ResourceManager * so that we can load data from the resource manager using URLs of the form @@ -105,7 +107,7 @@ public class Handler extends URLStreamHandler this.connected = true; } catch (IOException ioe) { - Log.warning("Could not find resource [url=" + this.url + + log.warning("Could not find resource [url=" + this.url + ", error=" + ioe.getMessage() + "]."); throw ioe; // rethrow } @@ -144,7 +146,7 @@ public class Handler extends URLStreamHandler { // we can only do this with PNGs if (!path.endsWith(".png")) { - Log.warning("Requested sub-tile of non-PNG resource " + + log.warning("Requested sub-tile of non-PNG resource " + "[bundle=" + bundle + ", path=" + path + ", dims=" + query + "]."); return _rmgr.getResource(bundle, path); @@ -166,7 +168,7 @@ public class Handler extends URLStreamHandler } catch (NumberFormatException nfe) { } if (width <= 0 || height <= 0 || tidx < 0) { - Log.warning("Bogus sub-image dimensions [bundle=" + bundle + + log.warning("Bogus sub-image dimensions [bundle=" + bundle + ", path=" + path + ", dims=" + query + "]."); throw new FileNotFoundException(path); } diff --git a/src/java/com/threerings/resource/Log.java b/src/java/com/threerings/resource/Log.java index aa406041..9071c8c2 100644 --- a/src/java/com/threerings/resource/Log.java +++ b/src/java/com/threerings/resource/Log.java @@ -21,36 +21,12 @@ package com.threerings.resource; +import com.samskivert.util.Logger; + /** - * A placeholder class that contains a reference to the log object used by - * the resource management package. + * Contains a reference to the log object used by the resource management package. */ public class Log { - public static com.samskivert.util.Log log = - new com.samskivert.util.Log("resource"); - - /** 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.resource"); } diff --git a/src/java/com/threerings/resource/NetworkResourceBundle.java b/src/java/com/threerings/resource/NetworkResourceBundle.java index 517ee5f7..4991e46c 100644 --- a/src/java/com/threerings/resource/NetworkResourceBundle.java +++ b/src/java/com/threerings/resource/NetworkResourceBundle.java @@ -30,6 +30,8 @@ import java.net.URL; import java.security.AccessControlException; import java.util.HashSet; +import static com.threerings.resource.Log.log; + /** * Resource bundle that retrieves its contents via HTTP over the network from a root URL. */ @@ -48,7 +50,7 @@ public class NetworkResourceBundle extends ResourceBundle try { _bundleURL = new URL(root + path); } catch (MalformedURLException mue) { - Log.warning("Created malformed URL for resource. [root=" + root + ", path=" + path); + log.warning("Created malformed URL for resource. [root=" + root + ", path=" + path); } _ident = path; @@ -75,7 +77,7 @@ public class NetworkResourceBundle extends ResourceBundle try { ucon = (HttpURLConnection) resourceUrl.openConnection(); } catch (IOException ioe) { - Log.warning("Unable to open connection [url=" + resourceUrl + ", ex=" + ioe + "]"); + log.warning("Unable to open connection [url=" + resourceUrl + ", ex=" + ioe + "]"); } if (ucon == null) { @@ -85,10 +87,10 @@ public class NetworkResourceBundle extends ResourceBundle ucon.connect(); return ucon.getInputStream(); } catch (IOException ioe) { - Log.warning("Unable to open input stream [url=" + resourceUrl + ", ex=" + ioe + "]"); + log.warning("Unable to open input stream [url=" + resourceUrl + ", ex=" + ioe + "]"); return null; } catch (AccessControlException ace) { - Log.warning("Unable to connect due to access permissions [url=" + resourceUrl + "]"); + log.warning("Unable to connect due to access permissions [url=" + resourceUrl + "]"); throw ace; } } diff --git a/src/java/com/threerings/resource/ResourceManager.java b/src/java/com/threerings/resource/ResourceManager.java index 04097392..a8e5bc7a 100644 --- a/src/java/com/threerings/resource/ResourceManager.java +++ b/src/java/com/threerings/resource/ResourceManager.java @@ -57,6 +57,8 @@ import com.samskivert.net.PathUtil; import com.samskivert.util.ResultListener; import com.samskivert.util.StringUtil; +import static com.threerings.resource.Log.log; + /** * The resource manager is responsible for maintaining a repository of resources that are * synchronized with a remote source. This is accomplished in the form of sets of jar files @@ -217,7 +219,7 @@ public class ResourceManager } }); } catch (SecurityException se) { - Log.info("Running in sandbox. Unable to bind rsrc:// handler."); + log.info("Running in sandbox. Unable to bind rsrc:// handler."); } } @@ -314,7 +316,7 @@ public class ResourceManager try { initObs.wait(); } catch (InterruptedException ie) { - Log.warning("Interrupted while waiting for bundles to unpack."); + log.warning("Interrupted while waiting for bundles to unpack."); } } } @@ -678,8 +680,7 @@ public class ResourceManager } catch (Exception e) { String errmsg = "Unable to load resource manager config [rdir=" + _rdir + ", cpath=" + configPath + "]"; - Log.warning(errmsg + "."); - Log.logStackTrace(e); + log.warning(errmsg + ".", e); throw new IOException(errmsg); } return config; @@ -776,8 +777,7 @@ public class ResourceManager // there's no way to find out if it's already closed or not, so we have to check // the exception message to determine if this is actually warning worthy if (!"closed".equals(ioe.getMessage())) { - Log.warning("Failure closing image input '" + iis + "'."); - Log.logStackTrace(ioe); + log.warning("Failure closing image input '" + iis + "'.", ioe); } } } @@ -797,7 +797,7 @@ public class ResourceManager if (!m.matches()) { // if we can't parse the java version we're in weird land and should probably just try // our luck with what we've got rather than try to download a new jvm - Log.warning("Unable to parse VM version, hoping for the best [version=" + verstr + "]"); + log.warning("Unable to parse VM version, hoping for the best [version=" + verstr + "]"); return 0; } @@ -829,7 +829,7 @@ public class ResourceManager for (ResourceBundle bundle : _bundles) { if (bundle instanceof FileResourceBundle && !((FileResourceBundle)bundle).sourceIsReady()) { - Log.warning("Bundle failed to initialize " + bundle + "."); + log.warning("Bundle failed to initialize " + bundle + "."); } if (_obs != null) { int pct = count*100/_bundles.size(); diff --git a/tests/src/java/com/threerings/jme/client/JabberApp.java b/tests/src/java/com/threerings/jme/client/JabberApp.java index 523ea4db..4a9fd28c 100644 --- a/tests/src/java/com/threerings/jme/client/JabberApp.java +++ b/tests/src/java/com/threerings/jme/client/JabberApp.java @@ -39,9 +39,10 @@ import com.threerings.util.Name; import com.threerings.presents.client.Client; import com.threerings.presents.net.UsernamePasswordCreds; -import com.threerings.jme.Log; import com.threerings.jme.JmeApp; +import static com.threerings.jme.Log.log; + /** * The main point of entry for the Jabber client application. It creates * and initializes the myriad components of the client and sets all the @@ -100,7 +101,7 @@ public class JabberApp extends JmeApp Client client = _client.getContext().getClient(); // pass them on to the client - 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 @@ -123,7 +124,7 @@ public class JabberApp extends JmeApp if (client.isLoggedOn()) { client.logoff(false); } - Log.info("Stopping."); + log.info("Stopping."); super.stop(); } diff --git a/tests/src/java/com/threerings/media/sound/SoundTestApp.java b/tests/src/java/com/threerings/media/sound/SoundTestApp.java index e6f2ed61..b5a1603a 100644 --- a/tests/src/java/com/threerings/media/sound/SoundTestApp.java +++ b/tests/src/java/com/threerings/media/sound/SoundTestApp.java @@ -22,14 +22,15 @@ package com.threerings.media.sound; import com.threerings.resource.ResourceManager; -import com.threerings.media.Log; + +import static com.threerings.media.Log.log; public class SoundTestApp { public SoundTestApp (String[] args) { if (args.length == 0) { - Log.info("Usage: runjava com.threerings.media.SoundTestApp " + + log.info("Usage: runjava com.threerings.media.SoundTestApp " + " [ ...]"); System.exit(0); } diff --git a/tests/src/java/com/threerings/media/util/TraceViz.java b/tests/src/java/com/threerings/media/util/TraceViz.java index c5176aa6..626e1498 100644 --- a/tests/src/java/com/threerings/media/util/TraceViz.java +++ b/tests/src/java/com/threerings/media/util/TraceViz.java @@ -38,10 +38,11 @@ import javax.swing.JPanel; import com.samskivert.swing.VGroupLayout; import com.samskivert.swing.util.SwingUtil; -import com.threerings.media.Log; import com.threerings.media.image.ClientImageManager; import com.threerings.media.image.ImageUtil; +import static com.threerings.media.Log.log; + /** * Simple application for testing image trace functionality. */ @@ -106,8 +107,7 @@ public class TraceViz app.run(); } catch (Exception e) { - Log.warning("Failed to run application: " + e); - Log.logStackTrace(e); + log.warning("Failed to run application.", e); } } diff --git a/tests/src/java/com/threerings/miso/client/ScrollingTestApp.java b/tests/src/java/com/threerings/miso/client/ScrollingTestApp.java index 6d461d72..403d35d1 100644 --- a/tests/src/java/com/threerings/miso/client/ScrollingTestApp.java +++ b/tests/src/java/com/threerings/miso/client/ScrollingTestApp.java @@ -50,11 +50,12 @@ import com.threerings.cast.CharacterSprite; import com.threerings.cast.NoSuchComponentException; import com.threerings.cast.bundle.BundledComponentRepository; -import com.threerings.miso.Log; import com.threerings.miso.MisoConfig; import com.threerings.miso.tile.MisoTileManager; import com.threerings.miso.util.MisoContext; +import static com.threerings.miso.Log.log; + /** * Tests the scrolling capabilities of the IsoSceneView. */ @@ -72,7 +73,7 @@ public class ScrollingTestApp // 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() + "]."); @@ -80,7 +81,7 @@ public class ScrollingTestApp // 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() + "]."); @@ -132,7 +133,7 @@ public class ScrollingTestApp } } catch (NoSuchComponentException nsce) { - Log.warning("Can't locate ship component [class=" + scclass + + log.warning("Can't locate ship component [class=" + scclass + ", name=" + scname + "]."); } @@ -159,12 +160,12 @@ public class ScrollingTestApp // size and position the window, entering full-screen exclusive // mode if available if (gd.isFullScreenSupported()) { - Log.info("Entering full-screen exclusive mode."); + log.info("Entering full-screen exclusive mode."); gd.setFullScreenWindow(_frame); _frame.setUndecorated(true); } else { - Log.warning("Full-screen exclusive mode not available."); + log.warning("Full-screen exclusive mode not available."); // _frame.pack(); _frame.setSize(200, 300); SwingUtil.centerWindow(_frame); @@ -173,8 +174,7 @@ public class ScrollingTestApp try { _panel.setSceneModel(new ScrollingScene(ctx)); } catch (Exception e) { - Log.warning("Error creating scene: " + e); - Log.logStackTrace(e); + log.warning("Error creating scene.", e); } } diff --git a/tests/src/java/com/threerings/miso/viewer/ViewerApp.java b/tests/src/java/com/threerings/miso/viewer/ViewerApp.java index 9c21d87e..20d88875 100644 --- a/tests/src/java/com/threerings/miso/viewer/ViewerApp.java +++ b/tests/src/java/com/threerings/miso/viewer/ViewerApp.java @@ -38,12 +38,13 @@ import com.threerings.media.tile.bundle.BundledTileSetRepository; import com.threerings.cast.CharacterManager; import com.threerings.cast.bundle.BundledComponentRepository; -import com.threerings.miso.Log; import com.threerings.miso.data.SimpleMisoSceneModel; import com.threerings.miso.tile.MisoTileManager; import com.threerings.miso.tools.xml.SimpleMisoSceneParser; import com.threerings.miso.util.MisoContext; +import static com.threerings.miso.Log.log; + /** * The ViewerApp is a scene viewing application that allows for trying * out game scenes in a pseudo-runtime environment. @@ -67,7 +68,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() + "]."); @@ -75,7 +76,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() + "]."); @@ -109,26 +110,25 @@ public class ViewerApp SimpleMisoSceneParser parser = new SimpleMisoSceneParser(""); SimpleMisoSceneModel model = parser.parseScene(args[0]); if (model == null) { - Log.warning("No miso scene found in scene file " + + log.warning("No miso scene found in scene file " + "[path=" + args[0] + "]."); System.exit(-1); } _panel.setSceneModel(model); } catch (Exception e) { - Log.warning("Unable to parse scene [path=" + args[0] + "]."); - Log.logStackTrace(e); + log.warning("Unable to parse scene [path=" + args[0] + "].", e); System.exit(-1); } // size and position the window, entering full-screen exclusive // mode if available if (gd.isFullScreenSupported()) { - Log.info("Entering full-screen exclusive mode."); + log.info("Entering full-screen exclusive mode."); gd.setFullScreenWindow(_frame); } else { - Log.warning("Full-screen exclusive mode not available."); + log.warning("Full-screen exclusive mode not available."); // _frame.pack(); _frame.setSize(600, 400); SwingUtil.centerWindow(_frame); diff --git a/tests/src/java/com/threerings/miso/viewer/ViewerSceneViewPanel.java b/tests/src/java/com/threerings/miso/viewer/ViewerSceneViewPanel.java index e045efae..e8000194 100644 --- a/tests/src/java/com/threerings/miso/viewer/ViewerSceneViewPanel.java +++ b/tests/src/java/com/threerings/miso/viewer/ViewerSceneViewPanel.java @@ -42,12 +42,13 @@ import com.threerings.media.util.Path; import com.threerings.media.util.PerformanceMonitor; import com.threerings.media.util.PerformanceObserver; -import com.threerings.miso.Log; import com.threerings.miso.MisoConfig; import com.threerings.miso.client.MisoScenePanel; import com.threerings.miso.data.MisoSceneModel; import com.threerings.miso.util.MisoContext; +import static com.threerings.miso.Log.log; + public class ViewerSceneViewPanel extends MisoScenePanel implements PerformanceObserver, PathObserver { @@ -78,7 +79,7 @@ public class ViewerSceneViewPanel extends MisoScenePanel public void setSceneModel (MisoSceneModel model) { super.setSceneModel(model); - Log.info("Using " + model + "."); + log.info("Using " + model + "."); } // documentation inherited @@ -144,7 +145,7 @@ public class ViewerSceneViewPanel extends MisoScenePanel // documentation inherited public void checkpoint (String name, int ticks) { - Log.info(name + " [ticks=" + ticks + "]."); + log.info(name + " [ticks=" + ticks + "]."); } // documentation inherited @@ -153,7 +154,7 @@ public class ViewerSceneViewPanel extends MisoScenePanel super.mousePressed(e); int x = e.getX(), y = e.getY(); - Log.info("Mouse pressed +" + x + "+" + y); + log.info("Mouse pressed +" + x + "+" + y); switch (e.getModifiers()) { case MouseEvent.BUTTON1_MASK: