Switch to new logging API.

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@510 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Michael Bayne
2008-05-27 22:55:10 +00:00
parent b521b4bfbf
commit e00b4ddd6b
108 changed files with 497 additions and 605 deletions
+6 -4
View File
@@ -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
* <a href="../presents/package.html">Presents</a> 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);
}
/**
@@ -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) {
+2 -27
View File
@@ -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);
}
}
@@ -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,
@@ -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
@@ -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 +
"].");
@@ -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;
}
}
+3 -2
View File
@@ -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;
}
@@ -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.
*/
@@ -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.
*/
@@ -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.
@@ -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.
*/
@@ -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.
*/
@@ -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 + "].");
}
}
@@ -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).
@@ -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;
@@ -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 + "].");
}
}
@@ -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;
}
@@ -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):
@@ -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.
*/
@@ -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;
}
@@ -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 <code>.properties</code> / <code>.mxml</code> 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;
}
@@ -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);
}
@@ -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;
}