From 4a734d00ef2e292887d7fc4dd2439197ec36eeee Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Fri, 14 Aug 2009 22:12:56 +0000 Subject: [PATCH] Drive-by logging varargification. Don't ask what I'm doing driving in this neighborhood. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5913 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../crowd/client/LocationDirector.as | 40 +++++++++---------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/src/as/com/threerings/crowd/client/LocationDirector.as b/src/as/com/threerings/crowd/client/LocationDirector.as index 8b231eda7..8dda02030 100644 --- a/src/as/com/threerings/crowd/client/LocationDirector.as +++ b/src/as/com/threerings/crowd/client/LocationDirector.as @@ -124,7 +124,7 @@ public class LocationDirector extends BasicDirector { // make sure the placeId is valid if (placeId < 0) { - log.warning("Refusing moveTo(): invalid placeId " + placeId + "."); + log.warning("Refusing moveTo(): invalid placeId", "placeId", placeId); return false; } @@ -142,13 +142,13 @@ public class LocationDirector extends BasicDirector // if the pending request has been outstanding more than a minute, go ahead and let // this new one through in an attempt to recover from dropped moveTo requests if (refuse) { - log.warning("Refusing moveTo; We have a request outstanding " + - "[ppid=" + _pendingPlaceId + ", npid=" + placeId + "]."); + log.warning("Refusing moveTo; We have a request outstanding", + "ppid", _pendingPlaceId, "npid", placeId); return false; } else { - log.warning("Overriding stale moveTo request [ppid=" + _pendingPlaceId + - ", npid=" + placeId + "]."); + log.warning("Overriding stale moveTo request", + "ppid", _pendingPlaceId, "npid", placeId); } } @@ -170,14 +170,14 @@ public class LocationDirector extends BasicDirector var placeId :int = _pendingPlaceId; _pendingPlaceId = -1; - log.info("moveTo failed [pid=" + placeId + ", reason=" + reason + "]."); + log.info("moveTo failed", "pid", placeId, "reason", reason); // let our observers know that something has gone horribly awry notifyFailure(placeId, reason); }; // issue a moveTo request - log.info("Issuing moveTo(" + placeId + ")."); + log.info("Issuing moveTo", "placeId", placeId); _lservice.moveTo(placeId, new MoveAdapter(success, failure)); return true; } @@ -267,8 +267,7 @@ public class LocationDirector extends BasicDirector try { _controller.mayLeavePlace(_plobj); } catch (e :Error) { - log.warning("Place controller choked in mayLeavePlace [plobj=" + _plobj + "]."); - log.logStackTrace(e); + log.warning("Place controller choked in mayLeavePlace", "plobj", _plobj, e); } } } @@ -304,7 +303,7 @@ public class LocationDirector extends BasicDirector // check whether we should use a custom class loader _controller = config.createController(); if (_controller == null) { - log.warning("Place config returned null controller [config=" + config + "]."); + log.warning("Place config returned null controller", "config", config); return; } _controller.init(_cctx, config); @@ -326,8 +325,7 @@ public class LocationDirector extends BasicDirector try { _controller.didLeavePlace(_plobj); } catch (e :Error) { - log.warning("Place controller choked in didLeavePlace [plobj=" + _plobj + "]."); - log.logStackTrace(e); + log.warning("Place controller choked in didLeavePlace", "plobj", _plobj, e); } _controller = null; } @@ -391,8 +389,7 @@ public class LocationDirector extends BasicDirector gotBodyObject(object as BodyObject); }; var failure :Function = function (oid :int, cause :ObjectAccessError) :void { - log.warning("Location director unable to fetch body object; all has gone horribly " + - "wrong [cause=" + cause + "]."); + log.warning("Unable to fetch body object; all has gone horribly wrong", cause); }; var client :Client = event.getClient(); @@ -442,7 +439,7 @@ public class LocationDirector extends BasicDirector // documentation inherited from interface public function forcedMove (placeId :int) :void { - log.info("Moving at request of server [placeId=" + placeId + "]."); + log.info("Moving at request of server", "placeId", placeId); if (!movePending()) { // clear out our old place information @@ -465,8 +462,7 @@ public class LocationDirector extends BasicDirector try { _controller.willEnterPlace(_plobj); } catch (e :Error) { - log.warning("Controller choked in willEnterPlace [place=" + _plobj + "]."); - log.logStackTrace(e); + log.warning("Controller choked in willEnterPlace", "place", _plobj, e); } } @@ -481,8 +477,8 @@ public class LocationDirector extends BasicDirector public function requestFailed (oid :int, cause :ObjectAccessError) :void { // aiya! we were unable to fetch our new place object; something is badly wrong - log.warning("Aiya! Unable to fetch place object for new location [plid=" + oid + - ", reason=" + cause + "]."); + log.warning("Aiya! Unable to fetch place object for new location", + "plid", oid, "reason", cause); // clear out our half initialized place info var placeId :int = _placeId; @@ -520,9 +516,9 @@ public class LocationDirector extends BasicDirector { if (_failureHandler != null) { log.warning("Requested to set failure handler, but we've already got one. The " + - "conflicting entities will likely need to perform more sophisticated " + - "coordination to deal with failures. [old=" + _failureHandler + - ", new=" + handler + "]."); + "conflicting entities will likely need to perform more sophisticated " + + "coordination to deal with failures.", + "old", _failureHandler, "new", handler); } else { _failureHandler = handler;