Files
narya/src/as/com/threerings/util/LogDaddy.as
T
Ray Greenwell 2f2ffdabbe Notes, figured out how to make a static initializer.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3932 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-03-09 22:14:08 +00:00

41 lines
1.1 KiB
ActionScript

package com.threerings.util {
import mx.logging.ILogger;
import mx.logging.LogEventLevel;
import mx.logging.targets.TraceTarget;
/**
* Jesus Horseradish Christ. I wanted to just call this class Log, but
* other classes that don't even import it are getting confused between
* this and the subclasses with the same name. It's possible that this
* is some wacky compiler bug.
*/
public class LogDaddy
{
/**
* Retrieve the Logger for the specified package name, and ensure
* that our log target is set up.
*/
public static function getLogger (pkg :String) :ILogger
{
return mx.logging.Log.getLogger(pkg);
}
/**
* Our static (class) initializer.
*/
private static function staticInit () :void
{
var targ :TraceTarget = new TraceTarget();
targ.filters = ["*"];
targ.level = LogEventLevel.DEBUG;
mx.logging.Log.addTarget(targ);
// we could do some stuff here: set up different targets
// with different log levels...
}
staticInit(); // call our static initializer
}
}