Package | org.spicefactory.lib.logging |
Class | public class LogContext |
Inheritance | LogContext Object |
getLogger
method
is the default way for obtaining a Logger
instance. Depending on the type of Application
implementations will delegate to the Flex Logging API or to the Spicelib Flash Logging Framework.
Which type of delegate the wrapper will use depends on the LogFactory
implementation
you provide. Instances of FlexLogFactory
will delegate to the Flex Logging API,
instances of FlashLogFactory
will delegate to the old Spicelib Flash Logging Framework.
When using Parsley the corresponding delegate will usually be set automatically. When using Spicelib on its own you have to specify the factory manually.
All Spicefactory classes use the LogContext
internally to obtain Logger instances.
In regular Flex application code there is usually no need to use this class. But if you create
libraries which might be used in Flex or Flash Applications this class may come in handy as it
allows you to add log statements to your classes and decide at deployment time whether they should
delegate to the Flex Logging API or to the Spicelib Flash Logging Framework.
Property | Defined By | ||
---|---|---|---|
factory : LogFactory [static]
The LogFactory for the global LogContext. | LogContext |
Method | Defined By | ||
---|---|---|---|
[static]
Returns the logger for the specified name. | LogContext |
factory | property |
factory:LogFactory
The LogFactory for the global LogContext.
This is the factory that will be used for all Loggers obtained with
LogContext.getLogger
.
Instances of FlexLogFactory
will delegate to the Flex Logging API,
while instances of FlashLogFactory
will delegate to the old Spicelib Flash Logging Framework.
public static function get factory():LogFactory
public static function set factory(value:LogFactory):void
getLogger | () | method |
public static function getLogger(name:Object):Logger
Returns the logger for the specified name. If the name parameter is a Class
instance, the fully qualified class name will be used. Otherwise the toString
method will be invoked on the given name instance.
The returned logger is actually a delegate. See the documentation for the LogContext class above for details.
Parameters
name:Object — the name of the logger
|
Logger — the logger for the specified name
|