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
+2 -4
View File
@@ -8,8 +8,6 @@ import flash.net.Socket;
import flash.utils.ByteArray;
import flash.utils.Endian;
import com.threerings.presents.Log;
/**
* Reads socket data until a complete frame is available.
* This dispatches a FrameAvailableEvent.FRAME_AVAILABLE once a frame
@@ -28,7 +26,7 @@ public class FrameReader extends EventDispatcher
*/
protected function socketHasData (event :ProgressEvent) :void
{
Log.debug("socketHasData(" + _socket.bytesAvailable + ")");
Log.getLog(this).debug("socketHasData(" + _socket.bytesAvailable + ")");
if (_curData == null) {
if (_socket.bytesAvailable < HEADER_SIZE) {
// if there are less bytes available than a header, let's
@@ -54,7 +52,7 @@ public class FrameReader extends EventDispatcher
if (_length === _curData.length) {
// we have now read a complete frame, let us dispatch the data
_curData.position = 0; // move the read pointer to the beginning
Log.debug("+ FrameAvailable");
Log.getLog(this).debug("+ FrameAvailable");
dispatchEvent(new FrameAvailableEvent(_curData));
_curData = null; // clear, so we know we need to first read length
+11 -9
View File
@@ -9,6 +9,8 @@ import com.threerings.util.ClassUtil;
public class ObjectInputStream
{
private static const log :Log = Log.getLog(ObjectInputStream);
public function ObjectInputStream (source :IDataInput = null)
{
if (source == null) {
@@ -35,7 +37,7 @@ public class ObjectInputStream
// a zero code indicates a null value
if (code == 0) {
Log.debug(DEBUG_ID + "Read null");
log.debug(DEBUG_ID + "Read null");
return null;
}
@@ -49,21 +51,21 @@ public class ObjectInputStream
// read in the class metadata
var cname :String = Translations.getFromServer(readUTF());
// Log.debug("read cname: " + cname);
// log.debug("read cname: " + cname);
var streamer :Streamer = Streamer.getStreamerByJavaName(cname);
if (streamer == Streamer.BAD_STREAMER) {
Log.warning("OMG, cannot stream " + cname);
log.warning("OMG, cannot stream " + cname);
return null;
}
// Log.debug("Got streamer (" + streamer + ")");
// log.debug("Got streamer (" + streamer + ")");
cmap = new ClassMapping(code, cname, streamer);
_classMap[code] = cmap;
Log.debug(DEBUG_ID +
log.debug(DEBUG_ID +
"Created mapping: (" + code + "): " + cname);
} else {
Log.debug(DEBUG_ID + "Read known code: (" + code + ")");
log.debug(DEBUG_ID + "Read known code: (" + code + ")");
cmap = (_classMap[code] as ClassMapping);
if (null == cmap) {
throw new IOError("Read object for which we have no " +
@@ -71,7 +73,7 @@ public class ObjectInputStream
}
}
// Log.debug("Creating object sleeve...");
// log.debug("Creating object sleeve...");
var target :Object;
if (cmap.streamer === null) {
var clazz :Class = ClassUtil.getClassByName(cmap.classname);
@@ -80,9 +82,9 @@ public class ObjectInputStream
} else {
target = cmap.streamer.createObject(this);
}
//Log.debug("Reading object...");
//log.debug("Reading object...");
readBareObjectImpl(target, cmap.streamer);
Log.debug(DEBUG_ID + "Read object: " + target);
log.debug(DEBUG_ID + "Read object: " + target);
return target;
} catch (me :MemoryError) {
@@ -8,6 +8,8 @@ import com.threerings.util.HashMap;
public class ObjectOutputStream
{
private static const log :Log = Log.getLog(ObjectOutputStream);
public function ObjectOutputStream (targ :IDataOutput)
{
_targ = targ;
@@ -38,7 +40,7 @@ public class ObjectOutputStream
// streamer may be null to indicate a Streamable object
if (streamer == Streamer.BAD_STREAMER) {
// TODO
Log.warning("OMG, cannot stream " + cname);
log.warning("OMG, cannot stream " + cname);
return;
}
-2
View File
@@ -1,7 +1,5 @@
package com.threerings.io {
import com.threerings.presents.Log;
public dynamic class TypedArray extends Array
{
public function TypedArray (jtype :String)
@@ -7,8 +7,6 @@ import com.threerings.io.ObjectOutputStream;
import com.threerings.io.Streamer;
import com.threerings.io.TypedArray;
import com.threerings.presents.Log;
/**
* A Streamer for Array objects.
*/
@@ -35,7 +33,7 @@ public class ArrayStreamer extends Streamer
_elementType = int;
} else {
com.threerings.presents.Log.warning("Other array types are " +
Log.getLog(this).warning("Other array types are " +
"currently not handled yet [jname=" + jname + "].");
throw new Error("Unimplemented bit");
}