SLF4Fx是为Flex开发的日志框架。
示例代码:
<?xmlversion="1.0"encoding="utf-8"?><mx:Applicationxmlns:mx="https://www.adobe.com/2006/mxml"layout="absolute"applicationComplete="init()"> <mx:Script><![CDATA[ importmx.logging.LogEventLevel; importorg.room13.slf4fx.Slf4FxLoggingTarget; importmx.logging.Log; importmx.logging.ILogger; privatevar_log:ILogger=Log.getLogger("org.room13.slf4fx.MyApplication"); privatefunctioninit():void{ Log.addTarget(newSlf4FxLoggingTarget("myApplication","mySecret")); } privatefunctiongenerateLogRecords():void{ _log.debug("level={0}{1}",LogEventLevel.DEBUG,"**DEBUG**"); _log.info("level={0}{1}",LogEventLevel.INFO,"**INFO**"); _log.warn("level={0}{1}",LogEventLevel.WARN,"**WARN**"); _log.error("level={0}{1}",LogEventLevel.ERROR,"**ERROR**"); _log.fatal("level={0}{1}",LogEventLevel.FATAL,"**FATAL**"); } ]]></mx:Script> <mx:Buttonlabel="Generatelogrecords"x="20"y="20"click="generateLogRecords()"/></mx:Application>
评论