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
@@ -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;
@@ -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);
}
@@ -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 + "].");
}
@@ -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);
}
}
}
@@ -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;
}
@@ -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);
@@ -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 <widths> element
if (set.getWidths() == null) {
Log.warning("Tile set definition missing valid <widths> " +
log.warning("Tile set definition missing valid <widths> " +
"element [set=" + set + "].");
valid = false;
}
// check for a <heights> element
if (set.getHeights() == null) {
Log.warning("Tile set definition missing valid <heights> " +
log.warning("Tile set definition missing valid <heights> " +
"element [set=" + set + "].");
valid = false;
}
// check for a <tileCounts> element
if (set.getTileCounts() == null) {
Log.warning("Tile set definition missing valid <tileCounts> " +
log.warning("Tile set definition missing valid <tileCounts> " +
"element [set=" + set + "].");
valid = false;
}
@@ -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 <imagePath> element
if (StringUtil.isBlank(set.getImagePath())) {
Log.warning("Tile set definition missing <imagePath> element " +
log.warning("Tile set definition missing <imagePath> element " +
"[set=" + set + "].");
valid = false;
}
@@ -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 <width> element
if (set.getWidth() == 0) {
Log.warning("Tile set definition missing valid <width> " +
log.warning("Tile set definition missing valid <width> " +
"element [set=" + set + "].");
valid = false;
}
// check for a <height> element
if (set.getHeight() == 0) {
Log.warning("Tile set definition missing valid <height> " +
log.warning("Tile set definition missing valid <height> " +
"element [set=" + set + "].");
valid = false;
}
@@ -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);