Main Page | Packages | Class Tree | Index | Help

xp.system

class Logger

Object
  |
  +--xp.system.Logger


class Logger
extends Object

Logger
A basic in logger

Provides extensible application wide logging support
Supportgs logging to trace, broadcasting a log event, and logging to a local connection
You enable logging by calling the initLogger method once per application then call the relevant logger method to log events
You can access the logger either through the static var logger in the Logger class or through the global variable logger
Inititlize Logger
import xp.system.Logger;
//init logger for local connection support
Logger.initLogger(false,false,true);
Call logger to append log events
//log events
_global.logger.error("RPC call failed - no valid connection");
_global.logger.warn("Were running low on coffe");
_global.logger.info("You should slow down");


Author:
ProWin Computers Ltd. - Rob Edgar

Version:
3.0.0.000

See also:


Field Summary

public static
BRIEF: Number
log verbosity constant - only info level logging

public static
DEBUG: Number
log verbosity constant info,warning and debug logging

public static
enableBroadcaster: Boolean
Enables broadcasting log events

public static
enableLocalConnection
Enables broadcasting log events via a local connection

public static
enableProfiling
Enables add profiling info to all log calls

public static
enableTrace: Boolean
Enables broadcasting log events via trace

public static
ERROR: Number
Event level constant error message

public static
INFO: Number
Event level constant info message

public static
levels: Array
array of event level names ERROR,WARNING,INFO

public static
NONE: Number
log verbosity constant - no message logging

public static
VERBOSE: Number
log verbosity constant info and warning logging

public static
WARN: Number
Event level constant warning message

Constructor

public
Logger ( logLevel: Number, logName: String)
Create a new log instance

Method Summary

public
error ( msg: Object ): Void
Log a message object with the ERROR Level.

public
info ( msg: Object ): Void
Log a message object with the INFO Level.

public static
initLogger ( output: Boolean, broadcast: Boolean, local: Boolean, profile: Boolean )
Initialize the global logger

public
isErrorEnabled ( ): Boolean
Check whether this logger is enabled for the error Level

public
isInfoEnabled ( ): Boolean
Check whether this logger is enabled for the info Level

public
isWarnEnabled ( ): Boolean
Check whether this logger is enabled for the warn Level

public
log ( level: Number, msg: Object ): Void
Log a message. This is the most generic printing method

public
onLog ( message ): Void
Callback for log messages

public
warn ( msg: Object ): Void
Log a message object with the WARN Level



Field Documentation

BRIEF

public static var BRIEF: Number
log verbosity constant - only info level logging

DEBUG

public static var DEBUG: Number
log verbosity constant info,warning and debug logging

enableBroadcaster

public static var enableBroadcaster: Boolean
Enables broadcasting log events

If true Logger broadcast the onLog event so that other classes for other appenders, default is false

enableLocalConnection

public static var enableLocalConnection
Enables broadcasting log events via a local connection

If true Logger broadcast the onLog event to other applications via a local connection default is false

enableProfiling

public static var enableProfiling
Enables add profiling info to all log calls

If true Logger broadcast messages included profiling data

enableTrace

public static var enableTrace: Boolean
Enables broadcasting log events via trace

If true Logger broadcast the onLog event to trace, default is true

ERROR

public static var ERROR: Number
Event level constant error message

INFO

public static var INFO: Number
Event level constant info message

levels

public static var levels: Array
array of event level names ERROR,WARNING,INFO

NONE

public static var NONE: Number
log verbosity constant - no message logging

VERBOSE

public static var VERBOSE: Number
log verbosity constant info and warning logging

WARN

public static var WARN: Number
Event level constant warning message


Constructor Documentation

Logger

public function Logger(logLevel: Number,
 logName: String)
Create a new log instance

Parameters:
logLevel
An optional parameter that, if used, must have one of the following values:
Logger.BRIEF to specify that only primary life-cycle event and error notifications will be sent to the log.
This is the default value if no value is specified.
Logger.VERBOSE to specify that all life-cycle event and error notifications will be sent to the log.
Logger.DEBUG to specify that metrics and fine-grained events and errors will be sent to the log.
logName

Method Documentation

error

public function error(msg: Object): Void
Log a message object with the ERROR Level.

This method first checks if this logger is ERROR enabled by comparing the level of this logger with WARN Level.
If the logger is ERROR enabled, then it converts the message object passed as parameter to a string.

Parameters:
msg
The message to log

info

public function info(msg: Object): Void
Log a message object with the INFO Level.

This method first checks if this logger is INFO enabled by comparing the level of this logger with WARN Level.
If the logger is INFO enabled, then it converts the message object passed as parameter to a string.

Parameters:
msg
The message to log

initLogger

public static function initLogger(output: Boolean,
 broadcast: Boolean,
 local: Boolean,
 profile: Boolean)
Initialize the global logger

Parameters:
output
Enable logging to trace
broadcast
Enable logging to Broadcast
local
Enable logging to local connection
profile
Enable adding timing data to broadcast messages

isErrorEnabled

public function isErrorEnabled(): Boolean
Check whether this logger is enabled for the error Level

Returns:
true if this logger is enabled for level error, false otherwise

isInfoEnabled

public function isInfoEnabled(): Boolean
Check whether this logger is enabled for the info Level

Returns:
true if this logger is enabled for level info, false otherwise

isWarnEnabled

public function isWarnEnabled(): Boolean
Check whether this logger is enabled for the warn Level

Returns:
true if this logger is enabled for level warn, false otherwise

log

public function log(level: Number,
 msg: Object): Void
Log a message. This is the most generic printing method

Parameters:
level
msg
The message to log

onLog

public function onLog(message): Void
Callback for log messages

Parameters:
message
The message to log

warn

public function warn(msg: Object): Void
Log a message object with the WARN Level

This method first checks if this logger is WARN enabled by comparing the level of this logger with WARN Level.
If the logger is WARN enabled, then it converts the message object passed as parameter to a string.

Parameters:
msg
The message to log

The documentation was generated from the following file:


Generated on 10/30/2005 9:34:02 PM by AS2Doc