Format our timestamp like the timestamp in our Java logs.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4927 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2008-01-27 22:51:19 +00:00
parent bab168d443
commit 80cbcdb396
+16 -2
View File
@@ -133,8 +133,7 @@ public class Log
protected function doLog (level :String, messages :Array) :void
{
// TODO: better Date formatting?
messages.unshift(new Date().toLocaleTimeString(), level, _spec);
messages.unshift(getTimeStamp(), level, _spec);
trace.apply(null, messages);
// possibly also dispatch to any other log targets.
@@ -146,6 +145,21 @@ public class Log
}
}
protected function getTimeStamp () :String
{
var d :Date = new Date();
// return d.toLocaleTimeString();
// format it like the date format in our java logs
return d.fullYear + "/" +
StringUtil.prepad(String(d.month + 1), 2, "0") + "/" +
StringUtil.prepad(String(d.date), 2, "0") + " " +
StringUtil.prepad(String(d.hours), 2, "0") + ":" +
StringUtil.prepad(String(d.minutes), 2, "0") + ":" +
StringUtil.prepad(String(d.seconds), 2, "0") + ":" +
StringUtil.prepad(String(d.milliseconds), 3, "0");
}
/** Our log specification. */
protected var _spec :String;