套件 | org.osmf.logging |
類別 | public class LoggerFactory |
繼承 | LoggerFactory Object |
語言版本: | ActionScript 3.0 |
產品版本: | OSMF 1.0 |
執行階段版本: | Flash Player 10, AIR 1.5 |
Clients are expected to subclass LoggerFactory to generate their own Logger objects.
相關 API 元素
公用方法
方法 | 定義自 | ||
---|---|---|---|
Creates and returns a logger for the specified category. | LoggerFactory | ||
指出物件是否有已定義的指定屬性。 | Object | ||
指出 Object 類別的實體是否位於指定為參數的物件原型鏈中。 | Object | ||
指出指定的屬性是否存在,以及是否可列舉。 | Object | ||
為迴圈作業設定動態屬性的可用性。 | Object | ||
傳回代表此物件的字串,根據地區特定慣例進行格式化。 | Object | ||
會傳回指定之物件的字串形式。 | Object | ||
會傳回指定之物件的基本值。 | Object |
方法詳細資訊
getLogger | () | 方法 |
範例 如何使用本範例
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); } } }
Tue Jun 12 2018, 03:47 PM Z