new ConsoleTarget(init)
Provides a logger target that uses the global trace() method to output log messages.
Parameters:
Name | Type | Description |
---|---|---|
init |
Object | A generic object containing properties with which to populate the newly instance. If this argument is |
Example
var Log = system.logging.Log ; var LoggerLevel = system.logging.LoggerLevel ; var ConsoleTarget = system.logging.targets.TraceTarget ; var target = new ConsoleTarget ({ includeChannel : true , includeDate : false , includeLevel : true , includeLines : true , includeMilliseconds : true , includeTime : true }) ; target.filters = ["*"] ; target.level = LoggerLevel.ALL ; var logger = Log.getLogger('test') ; logger.log( "Here is some myDebug info : {0} and {1}", 2.25 , true ) ; logger.debug( "Here is some debug message." ) ; logger.info( "Here is some info message." ) ; logger.warning( "Here is some warn message." ) ; logger.error( "Here is some error message." ) ; logger.critical( "Here is some critical error..." ) ; target.includeDate = false ; target.includeTime = false ; target.includeChannel = false ; logger.info( "test : [{0}, {1}, {2}]", 2, 4, 6 ) ;
Extends
Members
-
factory :system.logging.LoggerFactory
-
Determinates the LoggerFactory reference of the target, by default the target use the
system.logging.Log
singleton.Type:
- Inherited From:
-
filters
-
Determinates the filters array representation of the target.
- Inherited From:
-
includeChannel :boolean
-
Indicates if the channel for this target should added to the trace.
Type:
- boolean
- Inherited From:
- Default Value:
-
- false
-
includeDate :boolean
-
Indicates if the date should be added to the trace.
Type:
- boolean
- Inherited From:
- Default Value:
-
- false
-
includeLevel :boolean
-
Indicates if the level for the event should added to the trace.
Type:
- boolean
- Inherited From:
- Default Value:
-
- false
-
includeLines :boolean
-
Indicates if the line for the event should added to the trace.
Type:
- boolean
- Inherited From:
- Default Value:
-
- false
-
includeMilliseconds :boolean
-
Indicates if the milliseconds should be added to the trace. Only relevant when includeTime is
true
.Type:
- boolean
- Inherited From:
- Default Value:
-
- false
-
includeTime :boolean
-
Indicates if the time should be added to the trace.
Type:
- boolean
- Inherited From:
- Default Value:
-
- false
-
level
-
Determinates the level (LoggerLevel of this target.
- Inherited From:
-
separator :string
-
The separator string.
Type:
- string
- Inherited From:
Methods
-
addFilter(channel)
-
Inserts a channel in the fllters if this channel don't exist.
Parameters:
Name Type Description channel
string The channel to rgister.
- Inherited From:
Returns:
true
if the channel is add in the list. -
addLogger(logger)
-
Sets up this target with the specified logger. Note : this method is called by the framework and should not be called by the developer.
Parameters:
Name Type Description logger
system.logging.Logger The logger to register.
- Inherited From:
-
<protected> formatDate()
-
This method format the passed Date in arguments.
- Inherited From:
-
<protected> formatLevel()
-
This method format the passed level in arguments.
- Inherited From:
-
<protected> formatLines()
-
This method format the current line value.
- Inherited From:
-
<protected> formatMessage()
-
This method format the log message.
- Inherited From:
-
<protected> formatTime()
-
This method format the current Date passed in argument.
- Inherited From:
-
<protected> getDigit()
-
Returns the string representation of a number and use digit conversion.
- Inherited From:
Returns:
the string representation of a number and use digit conversion.
-
internalLog(message, level)
-
Descendants of this class should override this method to direct the specified message to the desired output.
Parameters:
Name Type Description message
string String containing preprocessed log message which may include time, date, channel, etc. based on property settings, such as
includeDate
,includeChannel
, etc.level
system.logging.LoggerLevel The level of the log message.
-
logEntry()
-
This method receive a
LoggerEntry
from an associated logger. A target uses this method to translate the event into the appropriate format for transmission, storage, or display. This method will be called only if the event's level is in range of the target's level. Descendants need to override this method to make it useful.- Inherited From:
-
removeFilter(channel)
-
Removes a channel in the fllters collection if this channel exist.
Parameters:
Name Type Description channel
string The channel to unregister.
- Inherited From:
Returns:
true
if the channel is removed. -
removeLogger()
-
Stops this target from receiving events from the specified logger.
- Inherited From:
-
resetLineNumber()
-
Resets the internal line number value (set to
1
).- Inherited From:
-
toString()
-
Returns the String representation of the object.
- Inherited From:
Returns:
the String representation of the object.