[flex]as3commons log使用方法
[flex]as3commons log使用方法
http://www.as3commons.org/ [flex]as3commons log使用方法
- <?xml version="1.0" encoding="utf-8"?>
- <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
- creationComplete="application1_creationCompleteHandler(event)"
- xmlns:debugger="com.demonsters.debugger.*">
- <fx:Script>
- <![CDATA[
- import com.demonsters.debugger.MonsterDebugger;
- import mx.events.FlexEvent;
- import org.as3commons.logging.api.*;
- import org.as3commons.logging.api.ILogger;
- import org.as3commons.logging.api.LOGGER_FACTORY;
- import org.as3commons.logging.setup.*;
- import org.as3commons.logging.setup.target.*;
- import org.as3commons.logging.util.captureUncaughtErrors;
- protected function click(event:MouseEvent):void
- {
- // TODO Auto-generated method stub
- var log:ILogger = getLogger(Test_log);
- log.debug("日志测试...");
- var o:Object={a:1,b:2,c:'d的',d:{a:1,b:2}};
- log.info(o);
- MonsterDebugger.trace(this, "世界你好!");
- monsterDebugger.trace(this,"asdfa撒旦发射");
- }
- protected function application1_creationCompleteHandler(event:FlexEvent):void
- {
- setup();
- }
- protected function button1_clickHandler(event:MouseEvent):void
- {
- // TODO Auto-generated method stub
- LOGGER_FACTORY.setup = null;
- }
- protected function button2_clickHandler(event:MouseEvent):void
- {
- setup();
- }
- private function setup():void{
- var format:String = "{date}{time} {logLevel} - {shortName}{atPerson}: - {message}\n";
- var col:IFormattingLogTarget = new TraceTarget();
- col.format=format;
- // captureUncaughtErrors(loaderInfo);
- //LOGGER_FACTORY.setup = new SimpleTargetSetup( mergeTargets( new TextFieldTarget(format,field),col,new AlconTarget(format)) );
- LOGGER_FACTORY.setup = new SimpleTargetSetup( mergeTargets( col) );
- //MonsterDebugger.initialize(this);
- }
- ]]>
- </fx:Script>
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
- <s:layout>
- <s:HorizontalLayout/>
- </s:layout>
- <s:Button label="log" click="click(event)"/>
- <s:Button label="offlog" click="button1_clickHandler(event)"/>
- <s:Button label="onlog" click="button2_clickHandler(event)"/>
- <debugger:MonsterDebuggerFlex id="monsterDebugger" visible="true" width="100" height="100"/>
- </s:Application>
[flex]as3commons log使用方法
热门文章推荐
- [HLS]做自己的m3u8点播系统使用HTTP Live Streaming(HLS技术)
- [FMS]FMS流媒体服务器配置与使用相关的介绍
- [AS3]什么是M3U8,与HTML5的区别是什么
- AS2.0 让flash自适应全屏,并且不自动缩放
- [AS3]as3.0的sound类常用技巧整理
- [AS3]as3与ByteArray详解、ByteArray介绍、ByteArray用法
- 关于RTMP,RTMPT,RTMPS,RTMPE,RTMPTE协议的介绍
- [JS]分享浏览器弹出窗口不被拦截JS示例
请稍候...