LogMessage is a dumb data holder that contains all the information about
the message to log.
These information are the the message to log, its level and the name of the logger that is responsible for logging the message.
The toString method uses the set stringifier to obtain its string representation. If you want a different appearance of the log message you can use the static setStringifier method to set your custom stringifier.
The PatternLogMessageStringifier supports different presentation styles. It allows to switch the log level, the logger name and the time on and off.
new LogMessage()public function LogMessage(message, level:LogLevel, loggerName:String, timeStamp:Number)
Constructs a new LogMessage instance.
If timeStamp is null or undefined this constructor
sets it by itself using the current time.
message | the message object to log |
level | the level of the passed-in message
|
loggerName | the name of the logger that logs the message
|
timeStamp | (optional) the number of milliseconds elapsed from 1/1/1970 until log this message was created |
static public function getStringifier(Void):StringifierReturns either the stringifier set via setStringifier or the default one which is an instance of class PatternLogMessageStringifier.
the currently used stringifier
static public function setStringifier(newStringifier:Stringifier):VoidSets a new stringifier to be used by the toString method.
If newStringifier is null the getStringifier method
will return the default stringifier.
newStringifier | the new stringifier to be used |
public function getMessage(Void)Returns the message object to log
message the message object to log
public function getLevel(Void):LogLevelReturns the level of the message.
the level of the message
public function getLoggerName(Void):StringReturns the name of the logger that logs the message.
the name of the logging logger
public function getTimeStamp(Void):NumberReturns the number of milliseconds elapsed from 1/1/1970 until message was created.
public function toString():StringUses the stringifier returned by the static getStringifier method to stringify this instance.
the string representation of this log message
toString() in org.as2lib.core.BasicInterface