Packageorg.as3commons.logging.api
Classpublic class LoggerFactory
InheritanceLoggerFactory Inheritance Object

Use the 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

ILogSetup
org.as3commons.logging.api.getLogger()
org.as3commons.logging.api.getNamedLogger()
org.as3commons.logging.api.getClassLogger()
org.as3commons.logging.setup.ILogTarget


Public Properties
 PropertyDefined By
  setup : ILogSetup
The currently applied setup.
LoggerFactory
Public Methods
 MethodDefined 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
Property Detail
setupproperty
setup:ILogSetup

The currently applied setup.

By changing this setup, all loggers handled by this LoggerFactory will be cleared and handed to this setup for augmentation.


Implementation
    public function get setup():ILogSetup
    public function set setup(value:ILogSetup):void

See also

Constructor Detail
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.

Parameters
setup:ILogSetup (default = null) — Default setup to be used for configuring the Logger instances.

See also

LOGGER_FACTORY;
Method Detail
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.

Returns
ILogger — Logger for the passed-in name