Switch to new logging API.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@608 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -21,36 +21,12 @@
|
||||
|
||||
package com.threerings.whirled.spot;
|
||||
|
||||
import com.samskivert.util.Logger;
|
||||
|
||||
/**
|
||||
* A placeholder class that contains a reference to the log object used by
|
||||
* the Whirled Spot services.
|
||||
* Contains a reference to the log object used by the Whirled Spot services.
|
||||
*/
|
||||
public class Log
|
||||
{
|
||||
public static com.samskivert.util.Log log =
|
||||
new com.samskivert.util.Log("whirled.spot");
|
||||
|
||||
/** Convenience function. */
|
||||
public static void debug (String message)
|
||||
{
|
||||
log.debug(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void info (String message)
|
||||
{
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void warning (String message)
|
||||
{
|
||||
log.warning(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void logStackTrace (Throwable t)
|
||||
{
|
||||
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
|
||||
}
|
||||
public static Logger log = Logger.getLogger("com.threerings.whirled.spot");
|
||||
}
|
||||
|
||||
@@ -46,13 +46,14 @@ import com.threerings.whirled.data.SceneModel;
|
||||
import com.threerings.whirled.data.ScenePlace;
|
||||
import com.threerings.whirled.util.WhirledContext;
|
||||
|
||||
import com.threerings.whirled.spot.Log;
|
||||
import com.threerings.whirled.spot.data.ClusteredBodyObject;
|
||||
import com.threerings.whirled.spot.data.Location;
|
||||
import com.threerings.whirled.spot.data.Portal;
|
||||
import com.threerings.whirled.spot.data.SpotCodes;
|
||||
import com.threerings.whirled.spot.data.SpotScene;
|
||||
|
||||
import static com.threerings.whirled.spot.Log.log;
|
||||
|
||||
/**
|
||||
* Extends the standard scene director with facilities to move between locations within a scene.
|
||||
*/
|
||||
@@ -124,7 +125,7 @@ public class SpotSceneDirector extends BasicDirector
|
||||
// look up the destination scene and location
|
||||
SpotScene scene = (SpotScene)_scdir.getScene();
|
||||
if (scene == null) {
|
||||
Log.warning("Requested to traverse portal when we have no scene " +
|
||||
log.warning("Requested to traverse portal when we have no scene " +
|
||||
"[portalId=" + portalId + "].");
|
||||
return false;
|
||||
}
|
||||
@@ -133,7 +134,7 @@ public class SpotSceneDirector extends BasicDirector
|
||||
int sceneId = _scdir.getScene().getId();
|
||||
int clSceneId = ScenePlace.getSceneId((BodyObject)_ctx.getClient().getClientObject());
|
||||
if (sceneId != clSceneId) {
|
||||
Log.warning("Client and server differ in opinion of what scene we're in " +
|
||||
log.warning("Client and server differ in opinion of what scene we're in " +
|
||||
"[sSceneId=" + clSceneId + ", cSceneId=" + sceneId + "].");
|
||||
return false;
|
||||
}
|
||||
@@ -141,14 +142,14 @@ public class SpotSceneDirector extends BasicDirector
|
||||
// find the portal they're talking about
|
||||
Portal dest = scene.getPortal(portalId);
|
||||
if (dest == null) {
|
||||
Log.warning("Requested to traverse non-existent portal [portalId=" + portalId +
|
||||
log.warning("Requested to traverse non-existent portal [portalId=" + portalId +
|
||||
", portals=" + StringUtil.toString(scene.getPortals()) + "].");
|
||||
return false;
|
||||
}
|
||||
|
||||
// prepare to move to this scene (sets up pending data)
|
||||
if (!_scdir.prepareMoveTo(dest.targetSceneId, rl)) {
|
||||
Log.info("Portal traversal vetoed by scene director [portalId=" + portalId + "].");
|
||||
log.info("Portal traversal vetoed by scene director [portalId=" + portalId + "].");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -161,7 +162,7 @@ public class SpotSceneDirector extends BasicDirector
|
||||
}
|
||||
|
||||
// issue a traversePortal request
|
||||
Log.info("Issuing traversePortal(" + sceneId + ", " + dest + ", " + sceneVer + ").");
|
||||
log.info("Issuing traversePortal(" + sceneId + ", " + dest + ", " + sceneVer + ").");
|
||||
_sservice.traversePortal(_ctx.getClient(), sceneId, portalId, sceneVer, _scdir);
|
||||
return true;
|
||||
}
|
||||
@@ -181,7 +182,7 @@ public class SpotSceneDirector extends BasicDirector
|
||||
// refuse if there's a pending location change or if we're already at the specified
|
||||
// location
|
||||
if (loc.equivalent(_location)) {
|
||||
Log.info("Not going to " + loc + "; we're at " + _location + " and we're headed to " +
|
||||
log.info("Not going to " + loc + "; we're at " + _location + " and we're headed to " +
|
||||
_pendingLoc + ".");
|
||||
if (listener != null) {
|
||||
// This isn't really a failure, it's just a no-op.
|
||||
@@ -191,7 +192,7 @@ public class SpotSceneDirector extends BasicDirector
|
||||
}
|
||||
|
||||
if (_pendingLoc != null) {
|
||||
Log.info("Not going to " + loc + "; we're at " + _location + " and we're headed to " +
|
||||
log.info("Not going to " + loc + "; we're at " + _location + " and we're headed to " +
|
||||
_pendingLoc + ".");
|
||||
if (listener != null) {
|
||||
// Already moving, best thing to do is ignore it.
|
||||
@@ -202,7 +203,7 @@ public class SpotSceneDirector extends BasicDirector
|
||||
|
||||
SpotScene scene = (SpotScene)_scdir.getScene();
|
||||
if (scene == null) {
|
||||
Log.warning("Requested to change locations, but we're not currently in any scene " +
|
||||
log.warning("Requested to change locations, but we're not currently in any scene " +
|
||||
"[loc=" + loc + "].");
|
||||
if (listener != null) {
|
||||
listener.requestFailed(new Exception("m.cant_get_there"));
|
||||
@@ -211,7 +212,7 @@ public class SpotSceneDirector extends BasicDirector
|
||||
}
|
||||
|
||||
int sceneId = _scdir.getScene().getId();
|
||||
Log.info("Sending changeLocation request [scid=" + sceneId + ", loc=" + loc + "].");
|
||||
log.info("Sending changeLocation request [scid=" + sceneId + ", loc=" + loc + "].");
|
||||
|
||||
_pendingLoc = (Location)loc.clone();
|
||||
ConfirmListener clist = new ConfirmListener() {
|
||||
@@ -245,7 +246,7 @@ public class SpotSceneDirector extends BasicDirector
|
||||
{
|
||||
SpotScene scene = (SpotScene)_scdir.getScene();
|
||||
if (scene == null) {
|
||||
Log.warning("Requested to join cluster, but we're not currently in any scene " +
|
||||
log.warning("Requested to join cluster, but we're not currently in any scene " +
|
||||
"[froid=" + froid + "].");
|
||||
if (listener != null) {
|
||||
listener.requestFailed(new Exception("m.cant_get_there"));
|
||||
@@ -253,7 +254,7 @@ public class SpotSceneDirector extends BasicDirector
|
||||
return;
|
||||
}
|
||||
|
||||
Log.info("Joining cluster [friend=" + froid + "].");
|
||||
log.info("Joining cluster [friend=" + froid + "].");
|
||||
|
||||
_sservice.joinCluster(_ctx.getClient(), froid, new ConfirmListener() {
|
||||
public void requestProcessed () {
|
||||
@@ -293,14 +294,14 @@ public class SpotSceneDirector extends BasicDirector
|
||||
// make sure we're currently in a scene
|
||||
SpotScene scene = (SpotScene)_scdir.getScene();
|
||||
if (scene == null) {
|
||||
Log.warning("Requested to speak to cluster, but we're not currently in any scene " +
|
||||
log.warning("Requested to speak to cluster, but we're not currently in any scene " +
|
||||
"[message=" + message + "].");
|
||||
return false;
|
||||
}
|
||||
|
||||
// make sure we're part of a cluster
|
||||
if (_self.getClusterOid() <= 0) {
|
||||
Log.info("Ignoring cluster speak as we're not in a cluster " +
|
||||
log.info("Ignoring cluster speak as we're not in a cluster " +
|
||||
"[cloid=" + _self.getClusterOid() + "].");
|
||||
return false;
|
||||
}
|
||||
@@ -333,7 +334,7 @@ public class SpotSceneDirector extends BasicDirector
|
||||
// documentation inherited from interface
|
||||
public void requestFailed (int oid, ObjectAccessException cause)
|
||||
{
|
||||
Log.warning("Unable to subscribe to cluster chat object [oid=" + oid +
|
||||
log.warning("Unable to subscribe to cluster chat object [oid=" + oid +
|
||||
", cause=" + cause + "].");
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.Iterator;
|
||||
|
||||
import com.samskivert.util.HashIntMap;
|
||||
|
||||
import com.threerings.whirled.spot.Log;
|
||||
import static com.threerings.whirled.spot.Log.log;
|
||||
|
||||
/**
|
||||
* An implementation of the {@link SpotScene} interface.
|
||||
@@ -103,7 +103,7 @@ public class SpotSceneImpl
|
||||
public void addPortal (Portal portal)
|
||||
{
|
||||
if (portal.portalId <= 0) {
|
||||
Log.warning("Refusing to add zero-id portal " +
|
||||
log.warning("Refusing to add zero-id portal " +
|
||||
"[scene=" + this + ", portal=" + portal + "].");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,13 +37,14 @@ import com.threerings.util.Name;
|
||||
import com.threerings.whirled.client.SceneService.SceneMoveListener;
|
||||
import com.threerings.whirled.data.ScenePlace;
|
||||
import com.threerings.whirled.server.SceneRegistry;
|
||||
import com.threerings.whirled.spot.Log;
|
||||
import com.threerings.whirled.spot.client.SpotService;
|
||||
import com.threerings.whirled.spot.data.Location;
|
||||
import com.threerings.whirled.spot.data.Portal;
|
||||
import com.threerings.whirled.spot.data.SpotCodes;
|
||||
import com.threerings.whirled.spot.data.SpotScene;
|
||||
|
||||
import static com.threerings.whirled.spot.Log.log;
|
||||
|
||||
/**
|
||||
* Provides the server-side implementation of the spot services.
|
||||
*/
|
||||
@@ -73,7 +74,7 @@ public class SpotProvider
|
||||
BodyObject body = (BodyObject)caller;
|
||||
int cSceneId = ScenePlace.getSceneId(body);
|
||||
if (cSceneId != sceneId) {
|
||||
Log.info("Ignoring stale traverse portal request [caller=" + caller.who() +
|
||||
log.info("Ignoring stale traverse portal request [caller=" + caller.who() +
|
||||
", oSceneId=" + sceneId + ", portalId=" + portalId +
|
||||
", cSceneId=" + cSceneId + "].");
|
||||
InvocationMarshaller.setNoResponse(listener);
|
||||
@@ -83,7 +84,7 @@ public class SpotProvider
|
||||
// obtain the source scene
|
||||
SpotSceneManager srcmgr = (SpotSceneManager)_screg.getSceneManager(sceneId);
|
||||
if (srcmgr == null) {
|
||||
Log.warning("Traverse portal missing source scene " +
|
||||
log.warning("Traverse portal missing source scene " +
|
||||
"[user=" + body.who() + ", sceneId=" + sceneId +
|
||||
", portalId=" + portalId + "].");
|
||||
throw new InvocationException(INTERNAL_ERROR);
|
||||
@@ -101,7 +102,7 @@ public class SpotProvider
|
||||
|
||||
// make sure this portal has valid info
|
||||
if (dest == null || !dest.isValid()) {
|
||||
Log.warning("Traverse portal with invalid portal [user=" + body.who() +
|
||||
log.warning("Traverse portal with invalid portal [user=" + body.who() +
|
||||
", scene=" + srcmgr.where() + ", pid=" + portalId + ", portal=" + dest +
|
||||
", portals=" + StringUtil.toString(rss.getPortals()) + "].");
|
||||
throw new InvocationException(NO_SUCH_PORTAL);
|
||||
@@ -122,7 +123,7 @@ public class SpotProvider
|
||||
BodyObject source = (BodyObject)caller;
|
||||
int cSceneId = ScenePlace.getSceneId(source);
|
||||
if (cSceneId != sceneId) {
|
||||
Log.info("Rejecting changeLocation for invalid scene [user=" + source.who() +
|
||||
log.info("Rejecting changeLocation for invalid scene [user=" + source.who() +
|
||||
", insid=" + cSceneId + ", wantsid=" + sceneId + ", loc=" + loc + "].");
|
||||
throw new InvocationException(INVALID_LOCATION);
|
||||
}
|
||||
@@ -130,7 +131,7 @@ public class SpotProvider
|
||||
// look up the scene manager for the specified scene
|
||||
SpotSceneManager smgr = (SpotSceneManager)_screg.getSceneManager(sceneId);
|
||||
if (smgr == null) {
|
||||
Log.warning("User requested to change location from non-existent scene " +
|
||||
log.warning("User requested to change location from non-existent scene " +
|
||||
"[user=" + source.who() + ", sceneId=" + sceneId + ", loc=" + loc +"].");
|
||||
throw new InvocationException(INTERNAL_ERROR);
|
||||
}
|
||||
@@ -155,7 +156,7 @@ public class SpotProvider
|
||||
// look up the scene manager for the specified scene
|
||||
SpotSceneManager smgr = (SpotSceneManager)_screg.getSceneManager(sceneId);
|
||||
if (smgr == null) {
|
||||
Log.warning("User requested to join cluster from non-existent scene " +
|
||||
log.warning("User requested to join cluster from non-existent scene " +
|
||||
"[user=" + source.who() + ", sceneId=" + sceneId +
|
||||
", foid=" + friendOid +"].");
|
||||
throw new InvocationException(INTERNAL_ERROR);
|
||||
@@ -223,7 +224,7 @@ public class SpotProvider
|
||||
// look up the scene manager for the specified scene
|
||||
SpotSceneManager smgr = (SpotSceneManager)_screg.getSceneManager(sceneId);
|
||||
if (smgr == null) {
|
||||
Log.warning("User requested cluster chat in non-existent scene " +
|
||||
log.warning("User requested cluster chat in non-existent scene " +
|
||||
"[user=" + message.speaker + ", sceneId=" + sceneId +
|
||||
", message=" + message + "].");
|
||||
return;
|
||||
|
||||
@@ -25,16 +25,19 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
import com.samskivert.util.HashIntMap;
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.presents.dobj.DObject;
|
||||
import com.threerings.presents.server.InvocationException;
|
||||
|
||||
import com.threerings.crowd.chat.data.UserMessage;
|
||||
import com.threerings.crowd.chat.server.SpeakUtil;
|
||||
import com.threerings.crowd.data.BodyObject;
|
||||
import com.threerings.crowd.data.OccupantInfo;
|
||||
import com.threerings.crowd.server.CrowdServer;
|
||||
import com.threerings.presents.dobj.DObject;
|
||||
import com.threerings.presents.server.InvocationException;
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.whirled.server.SceneManager;
|
||||
import com.threerings.whirled.spot.Log;
|
||||
|
||||
import com.threerings.whirled.spot.data.Cluster;
|
||||
import com.threerings.whirled.spot.data.ClusterObject;
|
||||
import com.threerings.whirled.spot.data.ClusteredBodyObject;
|
||||
@@ -45,6 +48,8 @@ import com.threerings.whirled.spot.data.SpotCodes;
|
||||
import com.threerings.whirled.spot.data.SpotScene;
|
||||
import com.threerings.whirled.spot.data.SpotSceneObject;
|
||||
|
||||
import static com.threerings.whirled.spot.Log.log;
|
||||
|
||||
/**
|
||||
* Handles the movement of bodies between locations in the scene and creates the necessary
|
||||
* distributed objects to allow bodies in clusters to chat with one another.
|
||||
@@ -143,7 +148,7 @@ public class SpotSceneManager extends SceneManager
|
||||
while (cliter.hasNext()) {
|
||||
ClusterRecord clrec = cliter.next();
|
||||
if (clrec.containsKey(bodyOid)) {
|
||||
Log.info("Pruning departed body from cluster [boid=" + bodyOid +
|
||||
log.info("Pruning departed body from cluster [boid=" + bodyOid +
|
||||
", cluster=" + clrec + "].");
|
||||
clrec.removeBody(bodyOid);
|
||||
if (clrec.size() == 0) {
|
||||
@@ -176,7 +181,7 @@ public class SpotSceneManager extends SceneManager
|
||||
if (from != null && from.targetPortalId != -1) {
|
||||
entry = _sscene.getPortal(from.targetPortalId);
|
||||
if (entry == null) {
|
||||
Log.warning("Body mapped at invalid portal [where=" + where() +
|
||||
log.warning("Body mapped at invalid portal [where=" + where() +
|
||||
", who=" + body.who() + ", from=" + from + "].");
|
||||
entry = _sscene.getDefaultEntrance();
|
||||
}
|
||||
@@ -212,7 +217,7 @@ public class SpotSceneManager extends SceneManager
|
||||
{
|
||||
SpotScene scene = (SpotScene)getScene();
|
||||
if (scene == null) {
|
||||
Log.warning("No scene in moveBodyToDefaultPortal()? [who=" + body.who() +
|
||||
log.warning("No scene in moveBodyToDefaultPortal()? [who=" + body.who() +
|
||||
", where=" + where() + "].");
|
||||
return;
|
||||
}
|
||||
@@ -221,7 +226,7 @@ public class SpotSceneManager extends SceneManager
|
||||
Location eloc = scene.getDefaultEntrance().getLocation();
|
||||
handleChangeLoc(body, eloc);
|
||||
} catch (InvocationException ie) {
|
||||
Log.warning("Could not move user to default portal [where=" + where() +
|
||||
log.warning("Could not move user to default portal [where=" + where() +
|
||||
", who=" + body.who() + ", error=" + ie + "].");
|
||||
}
|
||||
}
|
||||
@@ -241,7 +246,7 @@ public class SpotSceneManager extends SceneManager
|
||||
{
|
||||
// make sure they are in our scene
|
||||
if (!_ssobj.occupants.contains(source.getOid())) {
|
||||
Log.warning("Refusing change loc from non-scene occupant [where=" + where() +
|
||||
log.warning("Refusing change loc from non-scene occupant [where=" + where() +
|
||||
", who=" + source.who() + ", loc=" + loc + "].");
|
||||
throw new InvocationException(INTERNAL_ERROR);
|
||||
}
|
||||
@@ -277,7 +282,7 @@ public class SpotSceneManager extends SceneManager
|
||||
SceneLocation sloc = new SceneLocation(loc, source.getOid());
|
||||
if (!_ssobj.occupantLocs.contains(sloc)) {
|
||||
// complain if they don't already have a location configured
|
||||
Log.warning("Changing loc for occupant without previous loc [where=" + where() +
|
||||
log.warning("Changing loc for occupant without previous loc [where=" + where() +
|
||||
", who=" + source.who() + ", nloc=" + loc + "].");
|
||||
Thread.dumpStack();
|
||||
_ssobj.addToOccupantLocs(sloc);
|
||||
@@ -310,7 +315,7 @@ public class SpotSceneManager extends SceneManager
|
||||
// otherwise see if they sent us the user's oid
|
||||
DObject tobj = CrowdServer.omgr.getObject(targetOid);
|
||||
if (!(tobj instanceof BodyObject)) {
|
||||
Log.info("Can't join cluster, missing target [creator=" + joiner.who() +
|
||||
log.info("Can't join cluster, missing target [creator=" + joiner.who() +
|
||||
", targetOid=" + targetOid + "].");
|
||||
throw new InvocationException(NO_SUCH_CLUSTER);
|
||||
}
|
||||
@@ -318,7 +323,7 @@ public class SpotSceneManager extends SceneManager
|
||||
// make sure we're in the same scene as said user
|
||||
BodyObject friend = (BodyObject)tobj;
|
||||
if (friend.getPlaceOid() != joiner.getPlaceOid()) {
|
||||
Log.info("Refusing cluster join from non-proximate user [joiner=" + joiner.who() +
|
||||
log.info("Refusing cluster join from non-proximate user [joiner=" + joiner.who() +
|
||||
", jloc=" + joiner.location + ", target=" + friend.who() +
|
||||
", tloc=" + friend.location + "].");
|
||||
throw new InvocationException(NO_SUCH_CLUSTER);
|
||||
@@ -405,7 +410,7 @@ public class SpotSceneManager extends SceneManager
|
||||
{
|
||||
ClusterRecord clrec = getCluster(sourceOid);
|
||||
if (clrec == null) {
|
||||
Log.warning("Non-clustered user requested cluster speak [where=" + where() +
|
||||
log.warning("Non-clustered user requested cluster speak [where=" + where() +
|
||||
", chatter=" + message.speaker + " (" + sourceOid + "), " +
|
||||
"msg=" + message + "].");
|
||||
} else {
|
||||
@@ -472,7 +477,7 @@ public class SpotSceneManager extends SceneManager
|
||||
throws InvocationException
|
||||
{
|
||||
if (!(body instanceof ClusteredBodyObject)) {
|
||||
Log.warning("Refusing to add non-clustered body to cluster [cloid=" +
|
||||
log.warning("Refusing to add non-clustered body to cluster [cloid=" +
|
||||
_clobj.getOid() + ", size=" + size() + ", who=" + body.who() + "].");
|
||||
throw new InvocationException(INTERNAL_ERROR);
|
||||
}
|
||||
@@ -518,7 +523,7 @@ public class SpotSceneManager extends SceneManager
|
||||
{
|
||||
BodyObject body = (BodyObject)remove(bodyOid);
|
||||
if (body == null) {
|
||||
Log.warning("Requested to remove unknown body from cluster [cloid=" +
|
||||
log.warning("Requested to remove unknown body from cluster [cloid=" +
|
||||
_clobj.getOid() + ", size=" + size() + ", who=" + bodyOid + "].");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -29,11 +29,12 @@ import org.xml.sax.helpers.AttributesImpl;
|
||||
import com.megginson.sax.DataWriter;
|
||||
import com.threerings.tools.xml.NestableWriter;
|
||||
|
||||
import com.threerings.whirled.spot.Log;
|
||||
import com.threerings.whirled.spot.data.Location;
|
||||
import com.threerings.whirled.spot.data.SpotSceneModel;
|
||||
import com.threerings.whirled.spot.tools.EditablePortal;
|
||||
|
||||
import static com.threerings.whirled.spot.Log.log;
|
||||
|
||||
/**
|
||||
* Generates an XML representation of a {@link SpotSceneModel}.
|
||||
*/
|
||||
@@ -93,7 +94,7 @@ public class SpotSceneWriter
|
||||
attrs.addAttribute("", fields[ii].getName(), "", "",
|
||||
String.valueOf(fields[ii].get(portalLoc)));
|
||||
} catch (IllegalAccessException iae) {
|
||||
Log.warning("Unable to write portal field, skipping " +
|
||||
log.warning("Unable to write portal field, skipping " +
|
||||
"[field=" + fields[ii].getName() + ", e=" + iae + "].");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user