Modernized logging of safe object manager

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5652 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Jamie Doornbos
2009-02-11 21:51:52 +00:00
parent 1d9c2802ea
commit c5b7379dea
@@ -72,7 +72,7 @@ public class SafeObjectManager
oid :int, available :Function=null, failed :Function=null) :void oid :int, available :Function=null, failed :Function=null) :void
{ {
if (_entries[oid] != null ) { if (_entries[oid] != null ) {
_log.warning("Object " + oid + " already subscribed"); _log.warning("Object already subscribed", "oid", oid);
return; return;
} }
@@ -81,7 +81,7 @@ public class SafeObjectManager
entry.availableFn = available; entry.availableFn = available;
entry.failedFn = failed; entry.failedFn = failed;
sub.subscribe(_omgr); sub.subscribe(_omgr);
_log.info("Subscribing to " + sub); _log.debug("Subscribing", "sub", sub);
_entries[oid] = entry; _entries[oid] = entry;
} }
@@ -94,11 +94,11 @@ public class SafeObjectManager
{ {
var entry :Entry = _entries[oid] as Entry; var entry :Entry = _entries[oid] as Entry;
if (entry == null) { if (entry == null) {
_log.warning("Object " + oid + " not subscribed"); _log.warning("Object not subscribed", "oid", oid);
return; return;
} }
_log.info("Unsubscribing from " + entry.sub); _log.debug("Unsubscribing", "sub", entry.sub);
if (entry.obj != null) { if (entry.obj != null) {
entry.obj.removeListener(_objectDeathListenerAdapter); entry.obj.removeListener(_objectDeathListenerAdapter);
} }
@@ -115,7 +115,7 @@ public class SafeObjectManager
*/ */
public function unsubscribeAll () :void public function unsubscribeAll () :void
{ {
_log.info("Unsubscribing all objects"); _log.debug("Unsubscribing all objects");
// get the keys (integer ids of subscribed objects) // get the keys (integer ids of subscribed objects)
var ids :Array = new Array(); var ids :Array = new Array();
@@ -150,10 +150,10 @@ public class SafeObjectManager
{ {
var entry :Entry = _entries[obj.getOid()]; var entry :Entry = _entries[obj.getOid()];
if (entry == null) { if (entry == null) {
_log.warning("Object " + obj.getOid() + " available without request?!"); _log.warning("Object available without request", "obj", obj.which());
} else { } else {
_log.info("Object " + obj.getOid() + " now available"); _log.debug("Object now available", "obj", obj.which());
entry.obj = obj; entry.obj = obj;
} }
@@ -173,14 +173,13 @@ public class SafeObjectManager
{ {
var entry :Entry = _entries[oid]; var entry :Entry = _entries[oid];
if (entry == null) { if (entry == null) {
_log.warning("Object " + oid + " failed without request?!"); _log.warning("Object failed without request", "oid", oid);
} else { } else {
entry.failed = true; entry.failed = true;
} }
_log.warning("Failed to subscribe to object " + oid); _log.warning("Failed to subscribe", "oid", oid, cause);
_log.logStackTrace(cause);
if (_failed != null) { if (_failed != null) {
_failed(oid, cause); _failed(oid, cause);
@@ -198,14 +197,14 @@ public class SafeObjectManager
var entry :Entry = _entries[oid] as Entry; var entry :Entry = _entries[oid] as Entry;
if (entry == null) { if (entry == null) {
_log.warning("Unsubscribed object notified of destroy"); _log.warning("Unsubscribed object notified of destroy", "oid", oid);
} else { } else {
entry.destroyed = true; entry.destroyed = true;
entry.obj = null; entry.obj = null;
} }
_log.info("Object " + oid + " destroyed"); _log.debug("Object destroyed", "oid", destroyed);
} }
protected var _omgr :DObjectManager; protected var _omgr :DObjectManager;