The use of as3commons-logging is simple and straightforward, when in need of a logger use the LoggerFactory class to get one, e.g.
If the logger is specific to a class it's a good practice to use the
specific method
getClassLogger(clazz:Class)
:
The default ILogger returned by LoggerFactory
is simply using trace()
to log messages. In order to use a different logger a different
ILoggerFactory
should be set in the LoggerFactory class:
The ILogger interface provides the following logging levels:
ILogger log methods accept variable arguments usually taken to
format message string, e.g.
Adapting a logging framework to be used by as3commons-logging is very easy: just provide an implementation of the two main API interfaces: ILoggerFactory and ILogger using the targeted logging framework.
Implementing variable arguments replacement in log messages is not compulsory but considered a good practice in order to provide more transparent logging framework switching.