ActionScript® 3.0 Reference for the Adobe® Flash® Platform
Home  |  Show Packages and Classes List |  Packages  |  Classes  |  What's New  |  Index  |  Appendixes
org.osmf.logging 

Logger  - AS3 OSMF

Packageorg.osmf.logging
Classpublic class Logger
InheritanceLogger Inheritance Object

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

Logger defines the capabilities of a logger, the object that OSMF applications interact with to write logging messages.

View the examples

Related API Elements



Public Properties
 PropertyDefined By
  category : String
[read-only] The category value for the logger.
Logger
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
Public Methods
 MethodDefined By
  
Logger(category:String)
Constructor.
Logger
  
debug(message:String, ... rest):void
Logs a message with a "debug" level.
Logger
  
error(message:String, ... rest):void
Logs a message with a "error" level.
Logger
  
fatal(message:String, ... rest):void
Logs a message with a "fatal" level.
Logger
 Inherited
Indicates whether an object has a specified property defined.
Object
  
info(message:String, ... rest):void
Logs a message with a "info" level.
Logger
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
  
warn(message:String, ... rest):void
Logs a message with a "warn" level.
Logger
Property Detail

category

property
category:String  [read-only]

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

The category value for the logger.



Implementation
    public function get category():String
Constructor Detail

Logger

()Constructor
public function Logger(category:String)

Constructor.

Parameters
category:String — The category value for the logger.
Method Detail

debug

()method
public function debug(message:String, ... rest):void

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

Logs a message with a "debug" level.

Debug messages are informational messages that are fine-grained, and intended to be helpful when debugging.

Parameters

message:String — The information to log. This string can contain special special marker characters of the form {x}, where x is a zero-based index that will be replaced with the additional parameters found at that index if specified.
 
... rest — Additional parameters that can be subsituted in the message parameter at each "{x}" location, where x is an zero-based integer index into the Array of values specified.

error

()method 
public function error(message:String, ... rest):void

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

Logs a message with a "error" level.

Error messages are intended to capture error events that might still allow the application to continue running.

Parameters

message:String — The information to log. This string can contain special special marker characters of the form {x}, where x is a zero-based index that will be replaced with the additional parameters found at that index if specified.
 
... rest — Additional parameters that can be subsituted in the message parameter at each "{x}" location, where x is an zero-based integer index into the Array of values specified.

fatal

()method 
public function fatal(message:String, ... rest):void

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

Logs a message with a "fatal" level.

Fatal messages are intended to capture error events that are likely to lead to application failure.

Parameters

message:String — The information to log. This string can contain special special marker characters of the form {x}, where x is a zero-based index that will be replaced with the additional parameters found at that index if specified.
 
... rest — Additional parameters that can be subsituted in the message parameter at each "{x}" location, where x is an zero-based integer index into the Array of values specified.

info

()method 
public function info(message:String, ... rest):void

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

Logs a message with a "info" level.

Info messages are intended to be informational, as opposed to indicating a concern.

Parameters

message:String — The information to log. This string can contain special special marker characters of the form {x}, where x is a zero-based index that will be replaced with the additional parameters found at that index if specified.
 
... rest — Additional parameters that can be subsituted in the message parameter at each "{x}" location, where x is an zero-based integer index into the Array of values specified.

warn

()method 
public function warn(message:String, ... rest):void

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

Logs a message with a "warn" level.

Warn messages are intended to warn of events that could be harmful to the operation of the application.

Parameters

message:String — The information to log. This string can contain special special marker characters of the form {x}, where x is a zero-based index that will be replaced with the additional parameters found at that index if specified.
 
... rest — Additional parameters that can be subsituted in the message parameter at each "{x}" location, where x is an zero-based integer index into the Array of values specified.
LoggerExample.as

package
{
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    
    import org.osmf.elements.VideoElement;
    import org.osmf.logging.Logger;
    import org.osmf.logging.Log;
    import org.osmf.media.MediaPlayerSprite;
    import org.osmf.media.URLResource;

    public class LoggerSample extends Sprite
    {
        public function LoggerSample()
        {
            super();
            
            Log.loggerFactory = new ExampleLoggerFactory(); 
            logger = Log.getLogger("LoggerSample");
            
            stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.align = StageAlign.TOP_LEFT;
            
            var mediaPlayerSprite:MediaPlayerSprite = new MediaPlayerSprite();
            var urlResource:URLResource = new URLResource("rtmp://cp67126.edgefcs.net/ondemand/mediapm/strobe/content/test/SpaceAloneHD_sounas_640_500_short");
            var videoElement:VideoElement = new VideoElement(urlResource);
            
            addChild(mediaPlayerSprite);
            
            logger.debug("Ready to play video at " + urlResource.url.toString());
            mediaPlayerSprite.media = videoElement;    
        }
        
        private var logger:Logger;
    }
}
ExampleLoggerFactory.as

package
{
    import org.osmf.logging.Logger;
    import org.osmf.logging.LoggerFactory;

    public class ExampleLoggerFactory extends LoggerFactory
    {
        public function ExampleLoggerFactory()
        {
            super();
        }
        
        override public function getLogger(category:String):Logger
        {
            return new ExampleLogger(category);
        }
    }
}
ExampleLogger.as

package
{
    import org.osmf.logging.Logger;

    public class ExampleLogger extends Logger
    {
        public function ExampleLogger(category:String)
        {
            super(category);
        }
        
        override public function debug(message:String, ... rest):void
        {
            trace(message);
        }
    }
}