Packagevegas.logging.targets
Classpublic class SOSTarget
InheritanceSOSTarget Inheritance LineFormattedTarget Inheritance AbstractTarget Inheritance CoreEventDispatcher Inheritance CoreObject

Provides a logger target that uses the SOS Max console to output log messages. Thanks PowerFlasher and the SOS Max Console

Example :

  import vegas.logging.ILogger ;
  import vegas.logging.Log ;
  import vegas.logging.targets.SOSTarget ;
   
  // setup target
  var target:SOSTarget = new SOSTarget("myApplication", 0xD8F394) ;
  
  target.filters = [ "myApplication" ] ; // use a empty array to receive all logs.
  target.includeLines = true ;
  target.includeCategory = true ;
  target.includeDate = true ;
  target.includeTime = true ;
  target.includeLevel = true ;
  target.level = LogEventLevel.ALL ; 
  //target.setLevelColor(LogEventLevel.DEBUG, 0xFF0000) ;
  //target.levelPolicy = SOSType.DISABLE ; // SOSType.ENABLE default value
  target.sendFoldLevelMessage( LogEventLevel.DEBUG, "Init SOS console", "test a fold message" ) ;
  target.sendMessage("Init SOS console....") ;
  
  // register target
  Log.addTarget(target); 
  
  // create a log writer
  var logger:ILogger = Log.getLogger("myApplication") ;
  
  logger.log(LogEventLevel.DEBUG, "here is some myDebug info : {0} and {1}", 2.25 , true) ;
  logger.debug("DEBUG !!") ;
  logger.error("ERROR !!") ;
  logger.fatal("FATAL !!") ;
  logger.info("INFO !!") ;
  logger.warn("WARNING !!") ;
  logger.warn([3, 2, 4]) ;
  



Public Properties
 PropertyDefined by
  ALL_COLOR : Number = 0xD7EEFD
[static] Provides the color in the SOS console to display all levels.
SOSTarget
 Inheritedchannel : String
Indicates the channel of this dispatcher if this instance is global.
CoreEventDispatcher
 InheritedcharPlacement : String = "'*' must be the right most character."
[static] The static field used when throws an Error when the character placement failed.
AbstractTarget
 InheritedcharsInvalid : String = "The following characters are not valid: []~$^&/(){}<>+=_-`!@#%?,:;'\"
[static] The static field used when throws an Error when a character is invalid.
AbstractTarget
  connected : Boolean
[read-only] Returns 'true' if your application is connected with SOS Console.
SOSTarget
  DEBUG_COLOR : Number = 0xDEECFE
[static] Provides the 'debug' color in the SOS console.
SOSTarget
  DEFAULT_COLOR : Number = 0xFFFFFF
[static] Provides the 'default' color in the SOS console.
SOSTarget
  ERROR_COLOR : Number = 0xEDCC81
[static] Provides the 'error' color in the SOS console.
SOSTarget
 InheritederrorFilter : String = "Error for filter ''{0}'"
[static] The static field used when throws an Error when filter failed.
AbstractTarget
  FATAL_COLOR : Number = 0xFDD1B5
[static] Provides the 'fatal' color in the SOS console.
SOSTarget
 Inheritedfilters : Array
(read-write) Returns the filters array representation of this target.
AbstractTarget
  HOST : String = "localhost"
[static] Provides the default host in the SOS console to connect the internal XMLSocket.
SOSTarget
 InheritedincludeCategory : Boolean = false
Indicates if the category for this target should added to the trace.
LineFormattedTarget
 InheritedincludeDate : Boolean = false
Indicates if the date should be added to the trace.
LineFormattedTarget
 InheritedincludeLevel : Boolean = false
Indicates if the level for the event should added to the trace.
LineFormattedTarget
 InheritedincludeLines : Boolean = false
Indicates if the line for the event should added to the trace.
LineFormattedTarget
 InheritedincludeMilliseconds : Boolean = false
Indicates if the milliseconds should be added to the trace.
LineFormattedTarget
 InheritedincludeTime : Boolean = false
Indicates if the time should be added to the trace.
LineFormattedTarget
  INFO_COLOR : Number = 0xD2FAB8
[static] Provides the 'info' color in the SOS console.
SOSTarget
 InheritedisGlobal : Boolean
(read-only) Returns the value of the isGlobal flag of this model.
CoreEventDispatcher
 Inheritedlevel : LogEventLevel
(read-write) Returns the level of this target.
AbstractTarget
  levelPolicy : Number
Show the level colors.
SOSTarget
  PORT : Number = 4444
[static] Provides the default port in the SOS console to connect the internal XMLSocket.
SOSTarget
 Inheritedseparator : String = " "
The separator string.
LineFormattedTarget
  WARN_COLOR : Number = 0xFDFDB5
[static] Provides the 'warn' color in the SOS console.
SOSTarget
Public Methods
 MethodDefined by
  
SOSTarget(name:String = null, color:Number, isIdenfify:Boolean = true)
Creates a new SOSTarget instance.
SOSTarget
 Inherited
addCategory(category:String):Boolean
Insert a category in the fllters if this category don't exist.
AbstractTarget
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0.0, useWeakReference:Boolean = false):void
Allows the registration of event listeners on the event target.
CoreEventDispatcher
 Inherited
addLogger(logger:ILogger):void
Sets up this target with the specified logger.
AbstractTarget
 Inherited
addNamespace(nameSpace:String):Boolean
Add a new namespace in the filters array.
AbstractTarget
  
clear():void
Clear the console.
SOSTarget
  
close():void
Close the console socket connection.
SOSTarget
  
connect():void
Connect to the SOS console.
SOSTarget
 Inherited
dispatchEvent(event:Event):Boolean
Dispatches an event into the event flow.
CoreEventDispatcher
  
exit():void
Exit and close the SOS console.
SOSTarget
 Inherited
Returns the internal EventDispatcher reference.
CoreEventDispatcher
  
getFoldMessage(title:String, message:String, level:LogEventLevel):String
Returns the string socket representation to send a fold message in the SOSConsole.
SOSTarget
 Inherited
getIsGlobal():Boolean
Returns the value of the isGlobal flag of this model.
CoreEventDispatcher
 Inherited
Returns the internal ILogger reference of this ILogable object.
CoreObject
 Inherited
hasEventListener(type:String):Boolean
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
CoreEventDispatcher
 Inherited
hashCode():uint
Returns a hashcode value for the object.
CoreObject
  
identify():void
Shows some Information about the Connection.
SOSTarget
 Inherited
Creates and returns the internal EventDispatcher reference (this method is invoked in the constructor).
CoreEventDispatcher
  
internalLog(message:*, level:LogEventLevel):void
Descendants of this class should override this method to direct the specified message to the desired output.
SOSTarget
 Inherited
isLocked():Boolean
Returns true if the object is locked.
CoreEventDispatcher
 Inherited
lock():void
Locks the object.
CoreEventDispatcher
 Inherited
logEvent(event:LogEvent):void
This method handles a LogEvent from an associated logger.
LineFormattedTarget
 Inherited
registerEventListener(type:String, listener:Boolean, useCapture:int = false, priority:Boolean = 0, useWeakReference:* = false):void
Allows the registration of event listeners on the event target (Function or EventListener).
CoreEventDispatcher
 Inherited
removeCategory(category:String):Boolean
Remove a category in the fllters if this category exist.
AbstractTarget
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
CoreEventDispatcher
 Inherited
removeLogger(logger:ILogger):void
Stops this target from receiving events from the specified logger.
AbstractTarget
 Inherited
removeNamespace(nameSpace:String):Boolean
Removes an existing namespace in the filters array.
AbstractTarget
  
sendFoldLevelMessage(level:LogEventLevel, title:String, message:String):void
Send a fold message with a specific level.
SOSTarget
  
sendLevelMessage(level:LogEventLevel, message:String):void
Send a message with a specific level.
SOSTarget
  
sendMessage(msg:String):void
Send message or bufferize message if the SOS console is disconnected.
SOSTarget
  
setAppColor(color:Number):void
Sets the color of the application, the Color must be set as Integer Value.
SOSTarget
  
setAppName(name:String):void
Sets the name of the application.
SOSTarget
 Inherited
Sets the internal EventDispatcher reference.
CoreEventDispatcher
 Inherited
setGlobal(flag:Boolean = false, channel:String = null):void
Sets if the instance use a global EventDispatcher to dispatch this events, if the flag value is false the instance use a local EventDispatcher.
CoreEventDispatcher
  
setLevelColor(level:LogEventLevel, color:Number):void
Sets the color for a specific level.
SOSTarget
 Inherited
setLogger(log:ILogger = null):void
Sets the internal ILogger reference of this ILogable object.
CoreObject
 Inherited
toSource(indent:int = 0):String
Returns the string representation the source code of the object.
CoreEventDispatcher
 Inherited
toString():String
Returns the string representation of this instance.
CoreObject
 Inherited
unlock():void
Unlocks the display.
CoreEventDispatcher
 Inherited
unregisterEventListener(type:String, listener:Boolean, useCapture:* = false):void
Removes a listener (Function or EventListener object) from the EventDispatcher object.
CoreEventDispatcher
 Inherited
willTrigger(type:String):Boolean
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
CoreEventDispatcher
Protected Methods
 MethodDefined by
  
flush():void
Flush the target.
SOSTarget
 Inherited
formatDate(d:Date):String
This method format the passed Date in arguments.
LineFormattedTarget
 Inherited
formatLevel(level:String):String
This method format the passed level in arguments.
LineFormattedTarget
 Inherited
formatLines():String
This method format the current line value.
LineFormattedTarget
 Inherited
formatMessage(message:*, level:String, category:String, date:Date):String
This method format the log message.
LineFormattedTarget
 Inherited
formatTime(d:Date):String
This method format the current Date passed in argument.
LineFormattedTarget
 Inherited
getDigit(n:Number):String
Returns the string representation of a number and use digit conversion.
LineFormattedTarget
Public Constants
 ConstantDefined by
  CLEAR : String = "!SOS<clear/> "
[static] Provides the message to send in the SOS console to clear the console.
SOSTarget
  DISABLE : Number = 0
[static] Provides the value if you want 'disabled' the levels colors in the SOS Console.
SOSTarget
  ENABLE : Number = 1
[static] Provides the value if you want 'enabled' the levels colors in the SOS Console.
SOSTarget
  EXIT : String = "!SOS<exit/>"
[static] Provides the message to send in the SOS console to exit the console.
SOSTarget
Property detail
ALL_COLORproperty
public static var ALL_COLOR:Number = 0xD7EEFD

Provides the color in the SOS console to display all levels.

connectedproperty 
connected:Boolean  [read-only]

Returns 'true' if your application is connected with SOS Console.

Implementation
    public function get connected():Boolean
DEBUG_COLORproperty 
public static var DEBUG_COLOR:Number = 0xDEECFE

Provides the 'debug' color in the SOS console.

DEFAULT_COLORproperty 
public static var DEFAULT_COLOR:Number = 0xFFFFFF

Provides the 'default' color in the SOS console.

ERROR_COLORproperty 
public static var ERROR_COLOR:Number = 0xEDCC81

Provides the 'error' color in the SOS console.

FATAL_COLORproperty 
public static var FATAL_COLOR:Number = 0xFDD1B5

Provides the 'fatal' color in the SOS console.

HOSTproperty 
public static var HOST:String = "localhost"

Provides the default host in the SOS console to connect the internal XMLSocket.

INFO_COLORproperty 
public static var INFO_COLOR:Number = 0xD2FAB8

Provides the 'info' color in the SOS console.

levelPolicyproperty 
public var levelPolicy:Number

Show the level colors. Use SOSType.ENABLE or SOSType.DISABLE

PORTproperty 
public static var PORT:Number = 4444

Provides the default port in the SOS console to connect the internal XMLSocket.

WARN_COLORproperty 
public static var WARN_COLOR:Number = 0xFDFDB5

Provides the 'warn' color in the SOS console.

Constructor detail
SOSTarget()constructor
public function SOSTarget(name:String = null, color:Number, isIdenfify:Boolean = true)

Creates a new SOSTarget instance.

Parameters
name:String (default = null) — The name of the target application in the console.
 
color:Number — The color of the application in the console.
 
isIdenfify:Boolean (default = true) — Inficates if the target is identify or not.
Method detail
clear()method
public function clear():void

Clear the console.

close()method 
public function close():void

Close the console socket connection.

connect()method 
public function connect():void

Connect to the SOS console.

exit()method 
public function exit():void

Exit and close the SOS console.

flush()method 
protected function flush():void

Flush the target.

getFoldMessage()method 
public function getFoldMessage(title:String, message:String, level:LogEventLevel):String

Returns the string socket representation to send a fold message in the SOSConsole.

Parameters
title:String
 
message:String
 
level:LogEventLevel

Returns
String — the string socket representation to send a fold message in the SOSConsole.
identify()method 
public function identify():void

Shows some Information about the Connection. This time it is : HostName, HostAddress and Color.

internalLog()method 
public override function internalLog(message:*, level:LogEventLevel):void

Descendants of this class should override this method to direct the specified message to the desired output.

Parameters
message:* — String containing preprocessed log message which may include time, date, category, etc. based on property settings, such as includeDate, includeCategory, etc.
 
level:LogEventLevel — the LogEventLevel of the message.
sendFoldLevelMessage()method 
public function sendFoldLevelMessage(level:LogEventLevel, title:String, message:String):void

Send a fold message with a specific level.

Parameters
level:LogEventLevel
 
title:String
 
message:String
sendLevelMessage()method 
public function sendLevelMessage(level:LogEventLevel, message:String):void

Send a message with a specific level.

Parameters
level:LogEventLevel
 
message:String
sendMessage()method 
public function sendMessage(msg:String):void

Send message or bufferize message if the SOS console is disconnected.

Parameters
msg:String
setAppColor()method 
public function setAppColor(color:Number):void

Sets the color of the application, the Color must be set as Integer Value. So 16768477 equals 0xffdddd.

Parameters
color:Number
setAppName()method 
public function setAppName(name:String):void

Sets the name of the application.

Parameters
name:String
setLevelColor()method 
public function setLevelColor(level:LogEventLevel, color:Number):void

Sets the color for a specific level.

Parameters
level:LogEventLevel
 
color:Number

See also

LogEventLevel
Constant detail
CLEARconstant
public static const CLEAR:String = "!SOS<clear/> "

Provides the message to send in the SOS console to clear the console.

DISABLEconstant 
public static const DISABLE:Number = 0

Provides the value if you want 'disabled' the levels colors in the SOS Console.

ENABLEconstant 
public static const ENABLE:Number = 1

Provides the value if you want 'enabled' the levels colors in the SOS Console.

EXITconstant 
public static const EXIT:String = "!SOS<exit/>"

Provides the message to send in the SOS console to exit the console.