Access keys

ActionStepLogger

Kind of class: class
Inherits from: BasicClass
Implements:
Author: Simon Wacker
Classpath: org.as2lib.env.log.logger.ActionStepLogger
File last modified: Tuesday, 31 May 2005, 17:24:32
ActionStepLogger provides support for the ActionStep Debugger.

The actual logging is always made using the org.actionstep.ASDebugger.trace
method. No other output devices are supported. Use the SimpleLogger to be
able to add log handlers as you please which allows you to log to every device you
want.

Configure the ActionStep Debugger API as usually and just use this class in
your application to log messages or objects. This enables you to switch between
almost every available logging API without having to change the logs in your
application but just the underlying configuration on startup.

Constructor

ActionStepLogger

function ActionStepLogger (
name:String)
Constructs a new ActionStepLogger instance.

The default log level is ALL. This means all messages regardless of
their level are logged.

The name is used as class name for the ASDebugger.trace method, if
the passed class name is null or undefined.

Parameters:
name:
(optional) the name of this logger

Class properties

ALL

static ALL:Number = 5
(read,write)
All level.

DEBUG

static DEBUG:Number = 4
(read,write)
ActionStep debug level.

ERROR

static ERROR:Number = 1
(read,write)
ActionStep error level.

FATAL

static FATAL:Number = 0
(read,write)
ActionStep fatal level.

INFO

static INFO:Number = 3
(read,write)
ActionStep info level.

NONE

static NONE:Number = -1
(read,write)
None level.

WARNING

static WARNING:Number = 2
(read,write)
ActionStep warning level.

Instance methods

debug

function debug (
message, className:String, fileName:String, lineNumber:Number) : Void
Logs the passed-in message at debug level.

The message is only logged when the level is set to DEBUG or
a level above.

The message is always logged using ASDebugger.trace passing
at least the arguments message, the debug level and className,
fileName and lineNumber if specified.

If className is null or undefined, the name of this
logger is used instead.

Parameters:
message :
the message object to log
className :
(optional) the name of the class that logs the message
fileName :
(optional) the name of the file that declares the class
lineNumber:
(optional) the line number at which the logging call stands
See also:

error

function error (
message, className:String, fileName:String, lineNumber:Number) : Void
Logs the passed-in message at error level.

The message is only logged when the level is set to ERROR or
a level above.

The message is always logged using ASDebugger.trace passing
at least the arguments message, the error level and className,
fileName and lineNumber if specified.

If className is null or undefined, the name of this
logger is used instead.

Parameters:
message :
the message object to log
className :
(optional) the name of the class that logs the message
fileName :
(optional) the name of the file that declares the class
lineNumber:
(optional) the line number at which the logging call stands
See also:

fatal

function fatal (
message, className:String, fileName:String, lineNumber:Number) : Void
Logs the passed-in message at fatal level.

The message is only logged when the level is set to FATAL or
a level above.

The message is always logged using ASDebugger.trace passing
at least the arguments message, the fatal level and className,
fileName and lineNumber if specified.

If className is null or undefined, the name of this
logger is used instead.

Parameters:
message :
the message object to log
className :
(optional) the name of the class that logs the message
fileName :
(optional) the name of the file that declares the class
lineNumber:
(optional) the line number at which the logging call stands
See also:

getLevel

function getLevel (
Void) : Number
Returns the set level.
Returns:
the set level

getName

function getName (
Void) : String
Returns the name of this logger.

This method returns null if no name has been set via the
setName method nor on construction.

Returns:
the name of this logger

info

function info (
message, className:String, fileName:String, lineNumber:Number) : Void
Logs the passed-in message at info level.

The message is only logged when the level is set to INFO or
a level above.

The message is always logged using ASDebugger.trace passing
at least the arguments message, the info level and className,
fileName and lineNumber if specified.

If className is null or undefined, the name of this
logger is used instead.

Parameters:
message :
the message object to log
className :
(optional) the name of the class that logs the message
fileName :
(optional) the name of the file that declares the class
lineNumber:
(optional) the line number at which the logging call stands
See also:

isDebugEnabled

function isDebugEnabled (
Void) : Boolean
Checks if this logger is enabled for debug level log messages.
Returns:
true if debug messages are logged
See also:

isEnabled

function isEnabled (
level:Number) : Boolean
Checks whether this logger is enabled for the passed-in level.

false will be returned if:

  • This logger is not enabled for the passed-in level.
  • The passed-in level is null or undefined.
Parameters:
level:
the level to make the check upon
Returns:
true if this logger is enabled for the given level else
false
See also:

isErrorEnabled

function isErrorEnabled (
Void) : Boolean
Checks if this logger is enabled for error level log messages.
Returns:
true if error messages are logged
See also:

isFatalEnabled

function isFatalEnabled (
Void) : Boolean
Checks if this logger is enabled for fatal level log messages.
Returns:
true if fatal messages are logged
See also:

isInfoEnabled

function isInfoEnabled (
Void) : Boolean
Checks if this logger is enabled for info level log messages.
Returns:
true if info messages are logged
See also:

isWarningEnabled

function isWarningEnabled (
Void) : Boolean
Checks if this logger is enabled for warning level log messages.
Returns:
true if warning messages are logged
See also:

log

function log (
message, level:Number, className:String, fileName:String, lineNumber:Number) : Void
Logs the passed-in message at the given level.

The message is only logged when this logger is enabled for the
passed-in level.

The message is always logged using ASDebugger.trace passing
at least the arguments message and level and className,
fileName and lineNumber if specified.

If className is null or undefined, the name of this
logger is used instead.

Parameters:
message :
the message object to log
level :
the specific level at which the message shall be logged
className :
(optional) the name of the class that logs the message
fileName :
(optional) the name of the file that declares the class
lineNumber:
(optional) the line number at which the logging call stands
See also:

setLevel

function setLevel (
level:Number) : Void
Sets the log level.

The log level determines which messages are logged and which are not.

A level of value null or undefined is interpreted as level
ALL which is also the default level.

Parameters:
level:
the new log level

setName

function setName (
name:String) : Void
Sets the name of this logger.

The name is used as class name for the ASDebugger.trace method, if
the passed class name is null or undefined.

Parameters:
name:
the new name of this logger

warning

function warning (
message, className:String, fileName:String, lineNumber:Number) : Void
Logs the passed-in message at warning level.

The message is only logged when the level is set to WARNING
or a level above.

The message is always logged using ASDebugger.trace passing
at least the arguments message, the warning level and className,
fileName and lineNumber if specified.

If className is null or undefined, the name of this
logger is used instead.

Parameters:
message :
the message object to log
className :
(optional) the name of the class that logs the message
fileName :
(optional) the name of the file that declares the class
lineNumber:
(optional) the line number at which the logging call stands