class

LoggerEvent

The event types dispatched by the SmartFoxServer 2X JavaScript API internal logger.

Properties

new LoggerEvent()

Developers never istantiate the LoggerEvent class: only use its static properties.

The constants contained in this class are used to register the logging event listeners; when an event is dispatched, an object containing the logged message is passed to the listener.

Example

This example shows the approach to be implemented to listen to logging events.

var sfs = null;
function init()
{
	// Create SmartFox client instance
	sfs = new SFS2X.SmartFox();
	...
	// Get a reference to the API internal logger
	var logger = sfs.logger;
	// Enable logger events dispatching
	logger.enableEventDispatching = true;
	// Add event listener to the logger
	logger.addEventListener(SFS2X.LoggerEvent.ERROR, onErrorLogged, this);
	...
}
function onErrorLogged(evtParams)
{
	// Write the error message in a log text area of the application interface
	log.text += "The following error occurred: " + evtParams.message;
}

Properties

constant static

DEBUG string

The debug event type, dispatched when a low level message is logged by the SmartFoxServer 2X JavaScript API.

The object passed to the listener contains the following parameters:
Property Type Description
message string The logged debug message.
See also
Logger
constant static

ERROR string

The error event type, dispatched when an error message is logged by the SmartFoxServer 2X JavaScript API.

The object passed to the listener contains the following parameters:
Property Type Description
message string The logged error message.
See also
Logger
constant static

INFO string

The info event type, dispatched when a standard informative message is logged by the SmartFoxServer 2X JavaScript API.

The object passed to the listener contains the following parameters:
Property Type Description
message string The logged informative message.
See also
Logger
constant static

WARNING string

The warn event type, dispatched when a warning message is logged by the SmartFoxServer 2X JavaScript API.

The object passed to the listener contains the following parameters:
Property Type Description
message string The logged warning message.
See also
Logger