Class org.as2lib.env.log.logger.Log4fLogger

org.as2lib.core.BasicClass
   +--org.as2lib.env.log.logger.Log4fLogger

Implemented Interfaces

Logger

Description

Log4fLogger acts as a wrapper for a org.log4f.logging.logger instance of the Log4F Framework from Peter Armstrong.

Log4F (http://sourceforge.net/projects/log4f), by Peter Armstrong, is a Log4j-style logging framework for Flex applications. It is based on Ralf Siegel's public domain logging framework found at http://code.audiofarm.de/Logger and adds useful Flex-specific enhancements including a debug console, instance inspector etc.

Configure the Log4F Framework as normally and just use this class in your application to log messages. 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.

Field Index

ALL, DEBUG, ERROR, FATAL, INFO, NONE, WARNING

Method Index

new Log4fLogger()

addPublisher(), debug(), error(), fatal(), getFilter(), getLevel(), getName(), getParent(), getPublishers(), info(), isDebugEnabled(), isErrorEnabled(), isFatalEnabled(), isInfoEnabled(), isWarningEnabled(), removePublisher(), setFilter(), setLevel(), warning()

Inherited from BasicClass

toString()

Constructor Detail

Log4fLogger

public function Log4fLogger(name:String)

Constructs a new Log4fLogger instance.

Gets an Log4F Logger instance via the org.log4f.logging.Logger.getLogger method.

Parameters

namethe name of this logger

Field Detail

ALL

static public ALL:Level
Indicates that all messages shall be logged. This level is equivalent to the Log4F ALL level.

DEBUG

static public DEBUG:Level
Indicates that all messages at debug and higher levels shall be logged. This level is equivalent to the Log4F DEBUG level.

INFO

static public INFO:Level
Indicates that all messages at info and higher levels shall be logged. This level is equivalent to the Log4F INFO level.

WARNING

static public WARNING:Level
Indicates that all messages at warning and higher levels shall be logged. This level is equivalent to the Log4F WARN level.

ERROR

static public ERROR:Level
Indicates that all messages at error and higher levels shall be logged. This level is equivalent to the Log4F ERROR level.

FATAL

static public FATAL:Level
Indicates that all messages at fatal and higher levels shall be logged. This level is equivalent to the Log4F FATAL level.

NONE

static public NONE:Level
Indicates that no messages shall be logged; logging shall be turned off. This level is equivalent to the Log4F OFF level.

Method Detail

getName

public function getName(Void):String

Returns the name of this logger or undefined for anonymous loggers.

Return

the name of this logger

getParent

public function getParent(Void):org.log4f.logging.Logger

Returns the parent of this logger.

This method returns the nearest extant parent in the namespace. Thus if a logger is called "a.b.c.d", and a logger called "a.b" has been created but no logger "a.b.c" exists, then a call of getParent on the logger "a.b.c.d" will return the logger "a.b".

The parent for the anonymous Logger is always the root (global) logger.

The result will be undefined if it is called on the root (global) logger in the namespace.

Return

the parent of this logger

getPublishers

public function getPublishers(Void):List

Returns an array with publishers associated with this logger.

Return

an array with publishers that are associated with this logger

addPublisher

public function addPublisher(publisher:IPublisher):Boolean

Adds a new publisher to this logger.

Parameters

publisherthe publisher to add

Return

true if the publisher was added successfully else false

removePublisher

public function removePublisher(publisher:IPublisher):Boolean

Removes the given publisher from this logger.

Parameters

publisherthe publisher to remove

Return

true if the publisher was removed successfully else false

getFilter

public function getFilter(Void):IFilter

Returns the current filter for this logger.

Return

this logger's current filter or undefined

setFilter

public function setFilter(filter:IFilter):Void

Sets a new filter for this logger.

Parameters

filterthe new filter to set

getLevel

public function getLevel(Void):Level

Returns the log level specified for this logger.

The result may be undefined, which means that this logger's effective level will be inherited from its parent.

Return

this logger's level

setLevel

public function setLevel(level:Level):Void

Sets the log level specifying which messages at which levels will be logged by this logger.

Message levels lower than this value will be discarded. The level value OFF can be used to turn off logging.

If the new level is undefined, it means that this node should inherit its level from its nearest ancestor with a specific (non-undefined) level value.

Parameters

levelthe new level

isDebugEnabled

public function isDebugEnabled(Void):Boolean

Checks if this logger is enabled for debug level log messages.

Return

true if debug messages are logged

Specified By

isDebugEnabled() in org.as2lib.env.log.Logger

isInfoEnabled

public function isInfoEnabled(Void):Boolean

Checks if this logger is enabled for info level log messages.

Return

true if info messages are logged

Specified By

isInfoEnabled() in org.as2lib.env.log.Logger

isWarningEnabled

public function isWarningEnabled(Void):Boolean

Checks if this logger is enabled for warning level log messages.

Return

true if warning messages are logged

Specified By

isWarningEnabled() in org.as2lib.env.log.Logger

isErrorEnabled

public function isErrorEnabled(Void):Boolean

Checks if this logger is enabled for error level log messages.

Return

true if error messages are logged

Specified By

isErrorEnabled() in org.as2lib.env.log.Logger

isFatalEnabled

public function isFatalEnabled(Void):Boolean

Checks if this logger is enabled for fatal level log messages.

Return

true if fatal messages are logged

Specified By

isFatalEnabled() in org.as2lib.env.log.Logger

debug

public function debug(message):Void

Logs the message object to wrapped Log4F Logger at debug level.

Parameters

messagethe message object to log

Specified By

debug() in org.as2lib.env.log.Logger

info

public function info(message):Void

Logs the message object to wrapped Log4F Logger at info level.

Parameters

messagethe message object to log

Specified By

info() in org.as2lib.env.log.Logger

warning

public function warning(message):Void

Logs the message object to wrapped Log4F Logger at warning level.

The warning level is equivalent to the warn level of Log4F

Parameters

messagethe message object to log

Specified By

warning() in org.as2lib.env.log.Logger

error

public function error(message):Void

Logs the message object to wrapped Log4F Logger at error level.

Parameters

messagethe message object to log

Specified By

error() in org.as2lib.env.log.Logger

fatal

public function fatal(message):Void

Logs the message object to wrapped Log4F Logger at fatal level.

Parameters

messagethe message object to log

Specified By

fatal() in org.as2lib.env.log.Logger