Packageorg.as3commons.logging.setup
Classpublic class RegExpSetup
InheritanceRegExpSetup Inheritance Object
Implements ILogSetup

Since : 2

The RegExpSetup allows to filter different ILogSetup instances to differently named loggers.

This setup allows to restrict the logging to just work with certain loggers based on the name of it. This setup will check if the name of the logger really matches the RegExp given for the child setup. Just if it passes the name test the logger will be applied, here is a short example for matching just loggers starting with "org.as3commons":

       LOGGER_FACTORY.setup = new RegExpSetup()
             .addRule(/^org\.as3commons\./, new SimpleTargetSetup(TRACE_TARGET) );
     

The former example will trace nothing but the statements passed to loggers that start with "org.as3commons".

The setup offers two other methods that allow to write the former code shorter.

       LOGGER_FACTORY.setup = new RegExpSetup()
             // uses the trace target to all code in org.as3commons
             .addTargetRule(/^org\.as3commons\./, TRACE_TARGET );
             // uses just the debug level to all code in com.mycompany
             .addTargetRule(/^com\.mycompany\./, TRACE_TARGET, LogSetupLevel.DEBUG_ONLY );
             // overwrites the first definition by not allowing any output at
             // org.as3commons.logging
             .addNoLogRule(/^org\.as3commons\.logging\./ );
     



Public Methods
 MethodDefined By
  
Constructs a new RegExpSetup.
RegExpSetup
  
Adds a rule which defines when to remove loggers added by previous statements.
RegExpSetup
  
addRule(classRule:RegExp, setup:ILogSetup, personRule:RegExp = null):RegExpSetup
Adds a rule which defines when to use a setup for a logger according to the loggers name.
RegExpSetup
  
addTargetRule(rule:RegExp, target:ILogTarget, level:LogSetupLevel = null, personRule:RegExp = null):RegExpSetup
Adds a rule which defines when to use a certain ILogTarget with loggers.
RegExpSetup
  
applyTo(logger:Logger):void
Sets targets of the passed-in Logger to the ones desired by the setup.
RegExpSetup
  
dispose():void
RegExpSetup
Constructor Detail
RegExpSetup()Constructor
public function RegExpSetup()

Constructs a new RegExpSetup.

Method Detail
addNoLogRule()method
public function addNoLogRule(rule:RegExp):RegExpSetup

Adds a rule which defines when to remove loggers added by previous statements.

Its a shorthand method of:

addRule([rule], new SimpleTargetSetup( null ) );

Parameters

rule:RegExp — The rule to which the name of the logger has to match.

Returns
RegExpSetup — This setup instance.
addRule()method 
public function addRule(classRule:RegExp, setup:ILogSetup, personRule:RegExp = null):RegExpSetup

Adds a rule which defines when to use a setup for a logger according to the loggers name.

Parameters

classRule:RegExp — The rule to which the name of the logger has to match.
 
setup:ILogSetup — Setup to be applied to the loggers that match.
 
personRule:RegExp (default = null) — Rule to which the person has to match. (if null, all persons will match)

Returns
RegExpSetup — This setup instance.
addTargetRule()method 
public function addTargetRule(rule:RegExp, target:ILogTarget, level:LogSetupLevel = null, personRule:RegExp = null):RegExpSetup

Adds a rule which defines when to use a certain ILogTarget with loggers.

Its a shorthand method of:

addRule([rule], new LevelTargetSetup( [target], [level] ) );

Parameters

rule:RegExp — The rule to which the name of the logger has to match.
 
target:ILogTarget — Target used for these loggers.
 
level:LogSetupLevel (default = null) — Level that can restrict for which levels it should be used.
 
personRule:RegExp (default = null) — Rule to which the person has to match. (if null, all persons will match)

Returns
RegExpSetup — This setup instance.
applyTo()method 
public function applyTo(logger:Logger):void

Sets targets of the passed-in Logger to the ones desired by the setup.

The setup should fill the desired targets to the Logger instances created by LoggerFactory.

Parameters

logger:LoggerLogger to be augmented by the setup

dispose()method 
public function dispose():void

Since : 2.6