Packagecom.lightstreamer.as_client.logger
Classpublic class Logger
InheritanceLogger Inheritance Object

The flex client library internal logging is based on both the native mx.logging interface and the com.lightstreamer.as_client.logger interface. The Logger class is the logging engine directly supplied by the flex client library.

Library classes produce their log by sending messages both to Logger class instances and to native mx.logging.ILogger instances.

Each logger instance used is characterized by a name, while each log message has an associated level.

The library uses loggers with the following names:

The available levels are DEBUG, INFO, WARN and ERROR.

In order to make this log available to the user, application code must create suitable listeners and add these listeners to the loggers of interest. For the Flex native interface, this is achieved through instances of mx.logging.ILoggerTarget, where filters on logger names and levels can be defined.

To achieve the same with the flex client library internal logging system, a suitable listener can be attached to a Logger instance. In order to collect the output from multiple loggers, a logger hierarchy is defined through the logger names. A logger is a son of another logger if its name is composed by the father's name plus a dot ( . ) plus a second part of the name (eg: "a.b.c" is son of "a.b" and "a" while it's not a son of "a.d"). Messages published on son loggers are also published on the father.

This is an example:

       var traceAppender:TraceAppender = new TraceAppender(Logger.DEBUG);
       var logger:Logger = Logger.getLogger("com.lightstreamer.as_client");
       logger.addLoggerListener(traceAppender);
   

in this case, all log produced by the library is published through the Flash trace method.

See also

ERROR
WARN
INFO
DEBUG
com.lightstreamer.as_client.logger.TraceAppender
com.lightstreamer.as_client.logger.DataGridAppender


Public Properties
 PropertyDefined By
  DEBUG : uint = 0
[static] DEBUG logging level
Logger
  ERROR : uint = 15
[static] ERROR logging level
Logger
  INFO : uint = 5
[static] INFO logging level
Logger
  WARN : uint = 10
[static] WARN logging level
Logger
Public Methods
 MethodDefined By
  
Logger(name:String)
Constructor for Logger.
Logger
  
Add a listener to the Logger instance.
Logger
  
debug(mex:*):void
Publish a log message on the Logger object at DEBUG level.
Logger
  
error(mex:*):void
Publish a log message on the Logger object at ERROR level.
Logger
  
getLogger(loggerName:String):Logger
[static] Logger factory that gets a logger related to a specified name.
Logger
  
info(mex:*):void
Publish a log message on the Logger object at INFO level.
Logger
  
log(level:uint, mex:*):void
Publish a log message on this Logger object.
Logger
  
Remove a listener from the Logger instance.
Logger
  
warn(mex:*):void
Publish a log message on the Logger object at WARN level.
Logger
Property Detail
DEBUGproperty
public static var DEBUG:uint = 0

DEBUG logging level

ERRORproperty 
public static var ERROR:uint = 15

ERROR logging level

INFOproperty 
public static var INFO:uint = 5

INFO logging level

WARNproperty 
public static var WARN:uint = 10

WARN logging level

Constructor Detail
Logger()Constructor
public function Logger(name:String)

Constructor for Logger. This constructor should not be used, the static method getLogger should be used instead.

Parameters
name:String — The name of the desired logger.

See also

Method Detail
addLoggerListener()method
public function addLoggerListener(listener:LoggerListener):void

Add a listener to the Logger instance. Such listener will receive all the log lines from this logger and its sons. The listener also defines a threshold level, so that it will receive only the log lines with a level equal to or greater than the threshold.

Parameters

listener:LoggerListener — An instance of an object implementing the LoggerListener interface.

See also

debug()method 
public function debug(mex:*):void

Publish a log message on the Logger object at DEBUG level. The message is also published on an mx.logging.ILogger instance with the same name, using the corresponding level.

Parameters

mex:* — The message to be logged. It could be a String instance, an Error instance or any other object, provided that it has a toString method.

See also

error()method 
public function error(mex:*):void

Publish a log message on the Logger object at ERROR level. The message is also published on an mx.logging.ILogger instance with the same name, using the corresponding level.

Parameters

mex:* — The message to be logged. It could be a String instance, an Error instance or any other object, provided that it has a toString method.

See also

getLogger()method 
public static function getLogger(loggerName:String):Logger

Logger factory that gets a logger related to a specified name. If such logger does not exist it is created. A unique instance is always maintained for each logger name.

Parameters

loggerName:String — The name of the desired logger.

Returns
Logger — The desired Logger instance.
info()method 
public function info(mex:*):void

Publish a log message on the Logger object at INFO level. The message is also published on an mx.logging.ILogger instance with the same name, using the corresponding level.

Parameters

mex:* — The message to be logged. It could be a String instance, an Error instance or any other object, provided that it has a toString method.

See also

log()method 
public function log(level:uint, mex:*):void

Publish a log message on this Logger object. The message is also published on an mx.logging.ILogger instance with the same name, using the corresponding level.

Parameters

level:uint — The logging level of the given message. It should be one of DEBUG INFO WARN ERROR constants values. Specialized method are available as shortcuts to avoid to specify a logging level
 
mex:* — The message to be logged. It could be a String instance, an Error instance or any other object, provided that it has a toString method.

See also

removeLoggerListener()method 
public function removeLoggerListener(listener:LoggerListener):Boolean

Remove a listener from the Logger instance.

Parameters

listener:LoggerListener — An instance of an object implementing the LoggerListener interface that was previously added to this same Logger.

Returns
Boolean — true if the given listener is correctly found and so removed, false otherwise.

See also

warn()method 
public function warn(mex:*):void

Publish a log message on the Logger object at WARN level. The message is also published on an mx.logging.ILogger instance with the same name, using the corresponding level.

Parameters

mex:* — The message to be logged. It could be a String instance, an Error instance or any other object, provided that it has a toString method.

See also