Simplified logging facilities.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4131 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2006-05-19 22:47:44 +00:00
parent 98bbe02560
commit a22ca8b079
39 changed files with 286 additions and 358 deletions
@@ -7,16 +7,12 @@ import com.threerings.io.Streamable;
import com.threerings.util.Comparable;
import com.threerings.util.StringBuilder;
import com.threerings.presents.Log;
public /* abstract */ class DEvent
implements Streamable
{
public function DEvent (targetOid :int)
{
_toid = targetOid;
//Log.debug("unset old = " + UNSET_OLD_ENTRY);
}
/**
@@ -37,7 +33,8 @@ public /* abstract */ class DEvent
public function applyToObject (target :DObject) :Boolean
{
// TODO
Log.warning("DEvent.applyToTarget is really an abstract method.");
Log.getLog(this).warning(
"DEvent.applyToTarget is really an abstract method.");
return false;
}
@@ -11,11 +11,11 @@ import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.Streamable;
import com.threerings.presents.Log;
public class DObject // extends EventDispatcher
implements Streamable
{
private static const log :Log = Log.getLog(DObject);
public function getOid ():int
{
return _oid;
@@ -61,9 +61,9 @@ public class DObject // extends EventDispatcher
_listeners = new ArrayCollection();
} else if (_listeners.contains(listener)) {
com.threerings.presents.Log.warning("Refusing repeat listener registration " +
log.warning("Refusing repeat listener registration " +
"[dobj=" + which() + ", list=" + listener + "].");
com.threerings.presents.Log.logStackTrace(new Error());
log.logStackTrace(new Error());
return;
}
_listeners.addItem(listener);
@@ -94,9 +94,9 @@ public class DObject // extends EventDispatcher
(listener as EventListener).eventReceived(event);
}
} catch (e :Error) {
com.threerings.presents.Log.warning("Listener choked during notification " +
log.warning("Listener choked during notification " +
"[list=" + listener + ", event=" + event + "].");
com.threerings.presents.Log.logStackTrace(e);
log.logStackTrace(e);
}
}
}
@@ -114,7 +114,7 @@ public class DObject // extends EventDispatcher
_omgr.postEvent(event);
} else {
com.threerings.presents.Log.warning("Unable to post event, object has no omgr " +
log.warning("Unable to post event, object has no omgr " +
"[oid=" + getOid() + ", class=" + ClassUtil.getClassName(this) +
", event=" + event + "].");
}
+2 -4
View File
@@ -12,8 +12,6 @@ import com.threerings.io.ObjectOutputStream;
import com.threerings.io.Streamable;
import com.threerings.io.TypedArray;
import com.threerings.presents.Log;
/**
* The distributed set class provides a means by which an unordered set of
* objects can be maintained as a distributed object field. Entries can be
@@ -122,8 +120,8 @@ public class DSet
}
} else if (contains(elem)) {
com.threerings.presents.Log.warning("Refusing to add duplicate entry [set=" + this +
", entry=" + elem + "].");
Log.getLog(this).warning("Refusing to add duplicate entry " +
"[set=" + this + ", entry=" + elem + "].");
return false;
}
@@ -5,8 +5,6 @@ import com.threerings.io.ObjectOutputStream;
import com.threerings.util.StringBuilder;
import com.threerings.presents.Log;
/**
* An entry added event is dispatched when an entry is added to a {@link
* DSet} attribute of a distributed entry. It can also be constructed to
@@ -49,7 +47,8 @@ public class EntryAddedEvent extends NamedEvent
{
var added :Boolean = target[_name].add(_entry);
if (!added) {
Log.warning("Duplicate entry found [event=" + this + "].");
Log.getLog(this).warning(
"Duplicate entry found [event=" + this + "].");
}
return true;
}
@@ -5,8 +5,6 @@ import com.threerings.io.ObjectOutputStream;
import com.threerings.util.StringBuilder;
import com.threerings.presents.Log;
/**
* An entry removed event is dispatched when an entry is removed from a
* {@link DSet} attribute of a distributed object. It can also be
@@ -67,8 +65,8 @@ public class EntryRemovedEvent extends NamedEvent
_oldEntry = dset.removeKey(_key);
if (_oldEntry == null) {
// complain if there was actually nothing there
Log.warning("No matching entry to remove [key=" + _key +
", set=" + dset + "].");
Log.getLog(this).warning("No matching entry to remove " +
"[key=" + _key + ", set=" + dset + "].");
return false;
}
}
@@ -5,8 +5,6 @@ import com.threerings.io.ObjectOutputStream;
import com.threerings.util.StringBuilder;
import com.threerings.presents.Log;
/**
* An entry updated event is dispatched when an entry of a {@link DSet} is
* updated. It can also be constructed to request the update of an entry
@@ -67,8 +65,8 @@ public class EntryUpdatedEvent extends NamedEvent
_oldEntry = dset.update(_entry);
if (_oldEntry == null) {
// complain if we didn't update anything
Log.warning("No matching entry to update [entry=" + this +
", set=" + dset + "].");
Log.getLog(this).warning("No matching entry to update " +
"[entry=" + this + ", set=" + dset + "].");
return false;
}
}
@@ -8,8 +8,6 @@ import com.threerings.io.TypedArray;
import com.threerings.util.StringBuilder;
import com.threerings.presents.Log;
/**
* An oid list is used to store lists of object ids. The list will not
* allow duplicate ids. This class is not synchronized, with the
@@ -102,7 +100,7 @@ public class OidList
// documentation inherited from interface Streamable
public function writeObject (out :ObjectOutputStream) :void
{
Log.warning("TODO: Not implemented: " + this);
Log.getLog(this).warning("TODO: Not implemented: " + this);
}
// documentation inherited from interface Streamable
@@ -1,7 +1,5 @@
package com.threerings.presents.dobj {
import com.threerings.presents.Log;
public class SubscriberAdapter
implements Subscriber
{
@@ -14,7 +12,6 @@ public class SubscriberAdapter
// documentation inherited from interface Subscriber
public function objectAvailable (obj :DObject) :void
{
Log.debug("calling success function: " + _success);
_success(obj);
}