Packagecom.smartfoxserver.v2.logging
Classpublic class LoggerEvent
InheritanceLoggerEvent Inheritance BaseEvent Inheritance flash.events.Event

LoggerEvent is the class representing all the events dispatched by the SmartFoxServer 2X ActionScript 3 API internal logger.

The LoggerEvent parent class provides a public property called params which contains specific parameters depending on the event type.

View the examples

See also

Logger


Public Properties
 PropertyDefined By
 Inheritedparams : Object
Specifies the object containing the parameters of the event.
BaseEvent
Public Methods
 MethodDefined By
  
LoggerEvent(type:String, params:Object = null)
Creates a new LoggerEvent instance.
LoggerEvent
  
clone():Event
[override] Duplicates the instance of the LoggerEvent object.
LoggerEvent
  
toString():String
[override] Generates a string containing all the properties of the LoggerEvent object.
LoggerEvent
Public Constants
 ConstantDefined By
  DEBUG : String = debug
[static] The LoggerEvent.DEBUG constant defines the value of the type property of the event object for a debug event.
LoggerEvent
  ERROR : String = error
[static] The LoggerEvent.ERROR constant defines the value of the type property of the event object for a error event.
LoggerEvent
  INFO : String = info
[static] The LoggerEvent.INFO constant defines the value of the type property of the event object for a info event.
LoggerEvent
  WARNING : String = warn
[static] The LoggerEvent.WARNING constant defines the value of the type property of the event object for a warn event.
LoggerEvent
Constructor Detail
LoggerEvent()Constructor
public function LoggerEvent(type:String, params:Object = null)

Creates a new LoggerEvent instance.

Parameters
type:String — The type of event.
 
params:Object (default = null) — An object containing the parameters of the event.
Method Detail
clone()method
override public function clone():Event

Duplicates the instance of the LoggerEvent object.

Returns
Event — A new LoggerEvent object that is identical to the original.
toString()method 
override public function toString():String

Generates a string containing all the properties of the LoggerEvent object.

Returns
String — A string containing all the properties of the LoggerEvent object.
Constant Detail
DEBUGConstant
public static const DEBUG:String = debug

The LoggerEvent.DEBUG constant defines the value of the type property of the event object for a debug event.

The properties of the params object contained in the event object have the following values:

PropertyTypeDescription
messageStringThe logged debug message.

ERRORConstant 
public static const ERROR:String = error

The LoggerEvent.ERROR constant defines the value of the type property of the event object for a error event.

The properties of the params object contained in the event object have the following values:

PropertyTypeDescription
messageStringThe logged error message.

INFOConstant 
public static const INFO:String = info

The LoggerEvent.INFO constant defines the value of the type property of the event object for a info event.

The properties of the params object contained in the event object have the following values:

PropertyTypeDescription
messageStringThe logged information message.

WARNINGConstant 
public static const WARNING:String = warn

The LoggerEvent.WARNING constant defines the value of the type property of the event object for a warn event.

The properties of the params object contained in the event object have the following values:

PropertyTypeDescription
messageStringThe logged warning message.

Examples
The following example gets a reference to the logger from the main SmartFox class and add a LoggerEvent listener; please refer to the specific event types for the params object content:
     
     private function someMethod():void
     {
         var logger:Logger = sfs.logger;
         logger.addEventListener(LoggerEvent.ERROR, onErrorLogged);
     }
     
     private function onErrorLogged(evt:LoggerEvent):void
     {
         // Write the error message in a log text area in the application interface
         log.text = "The following error occurred: " + evt.params.message;
     }