| Package | org.as3commons.logging.api |
| Class | public class LoggerFactory |
| Inheritance | LoggerFactory Object |
LoggerFactory to obtain a logger. This is the main class used when
working with the as3commons-logging library.
package {
import org.as3commons.logging.api.ILogger;
import org.as3commons.logging.api.getLogger;
public class MyClass {
private static const logger: ILogger = getLogger( MyClass );
public function doSomething(): void {
logger.info("hi");
}
}
}
By default the Logger instances will redirect to the
TRACE_TARGET (using trace for the output). To
change that to your preferred logging mechanism change the setup
of the logger factory.
org.as3commons.logging.api.LOGGER_FACTORY.setup = new FlexSetup();
// will redirect all output to the flex logging mechanism
org.as3commons.logging.api.LOGGER_FACTORY.setup = null;
// will clear all output
Performance Note:
getLogger is slightly slower than
getClassLogger and both are a bit slower than
getNamedLogger(). Nevertheless, it has advantages to use
getClassLogger(): In a development environment that updates
class references on rename its safer (in terms of: less exposed to bugs)
and faster to use the getLogger(). If you create libraries with
a lot of classes its recommended to use getNamedLogger().
See also
| Method | Defined By | ||
|---|---|---|---|
LoggerFactory(setup:ILogSetup = null)
Constructs a new LoggerFactory instance. | LoggerFactory | ||
getNamedLogger(name:String = null, person:String = null):ILogger
Returns a ILogger instance for the passed-in name. | LoggerFactory | ||
| setup | property |
setup:ILogSetupThe currently applied setup.
By changing this setup, all loggers handled by this LoggerFactory
will be cleared and handed to this setup for augmentation.
public function get setup():ILogSetup public function set setup(value:ILogSetup):voidSee also
| LoggerFactory | () | Constructor |
public function LoggerFactory(setup:ILogSetup = null)
Constructs a new LoggerFactory instance.
Usually you don't need to create your own instance. The commonly
used instance of this class would be available in the global constant:
LOGGER_FACTORY.
setup:ILogSetup (default = null) — Default setup to be used for configuring the Logger
instances.
|
See also
| getNamedLogger | () | method |
public function getNamedLogger(name:String = null, person:String = null):ILogger
Returns a ILogger instance for the passed-in name.
Parameters
name:String (default = null) — Name of the logger to be received, null and undefined are allowed
| |
person:String (default = null) — Information about the person that requested this logger.
|
ILogger — Logger for the passed-in name
|