Access keys

LogMessage

Kind of class: class
Inherits from: BasicClass
Author: Simon Wacker
Classpath: org.as2lib.env.log.LogMessage
File last modified: Saturday, 28 May 2005, 12:13:58
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 org.as2lib.env.log.stringifier.PatternLogMessageStringifier supports different presentation styles.
It allows to switch the log level, the logger name and the time on and off.

Summary

Constructor
Instance methods
Instance methods inherited from BasicClass

Constructor

LogMessage

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.

Parameters:
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

Class methods

getStringifier

static function getStringifier (
Void) : Stringifier
Returns either the stringifier set via setStringifier or the default
one which is an instance of class org.as2lib.env.log.stringifier.PatternLogMessageStringifier.
Returns:
the currently used stringifier

setStringifier

static function setStringifier (
newStringifier:Stringifier) : Void
Sets a new stringifier to be used by the toString method.

If newStringifier is null the getStringifier method
will return the default stringifier.

Parameters:
newStringifier:
the new stringifier to be used

Instance methods

getLevel

function getLevel (
Void) : LogLevel
Returns the level of the message.
Returns:
the level of the message

getLoggerName

function getLoggerName (
Void) : String
Returns the name of the logger that logs the message.
Returns:
the name of the logging logger

getMessage

function getMessage (
Void)
Returns the message object to log
Returns:
message the message object to log

getTimeStamp

function getTimeStamp (
Void) : Number
Returns the number of milliseconds elapsed from 1/1/1970 until message was
created.
Returns:
the number of milliseconds elapsed from 1/1/1970 until message was
created.

toString

function toString (
) : String
Uses the stringifier returned by the static getStringifier method
to stringify this instance.
Returns:
the string representation of this log message