i try everything to get the LogProcessor for Swiz to run. Here are the project Foomonger. I fear however, the ressources refer to an old version of swiz.
I want to implement the LogProceccor without the SwizLoggerConfig, because i need only the possibility to log some informations to thunderbolt. i need no further configuration. After that i start to write my own AbstractSwizLoggingTarget.
If i copy the class into my environment, i get t开发者_JAVA百科he follow error: TypeError: Error #1034: Typumwandlung fehlgeschlagen: org.swizframework.utils.logging::SwizLogger@e8aa8b1 kann nicht in mx.logging.ILogger umgewandelt werden. (Sorry for the german text)
Der Quelltext:
package de.axurit.util
{
import org.swizframework.core.Bean;
import org.swizframework.processors.BaseMetadataProcessor;
import org.swizframework.processors.ProcessorPriority;
import org.swizframework.reflection.IMetadataTag;
import org.swizframework.utils.logging.SwizLogger;
public class LoggerProcessor extends BaseMetadataProcessor
{
protected static const LOGGER:String = "Logger";
public function LoggerProcessor()
{
super([LOGGER]);
}
override public function get priority():int
{
return ProcessorPriority.INJECT +1;
}
override public function setUpMetadataTag(metadataTag:IMetadataTag, bean:Bean):void
{
var logger:SwizLogger = SwizLogger.getLogger(bean.source);
bean.source[metadataTag.host.name] = logger; //here occurs the error
}
override public function tearDownMetadataTag(metadataTag:IMetadataTag, bean:Bean):void
{
bean.source[metadataTag.host.name] = null;
}
}
}
Can anyone help me how to create an own MetadataProcessor for central logging (not debuggin) in Swiz. I you need more code, let me know that
Thank you Frank
It was a long, hard journey. Here is teh result:
package de.axurit.util
{
import org.swizframework.core.Bean;
import org.swizframework.processors.BaseMetadataProcessor;
import org.swizframework.reflection.IMetadataTag;
import org.swizframework.utils.logging.SwizLogger;
public class LoggerProcessor extends BaseMetadataProcessor
{
public function LoggerProcessor()
{
super(["Log"]);
}
override public function setUpMetadataTag(metadataTag:IMetadataTag, bean:Bean):void
{
super.setUpMetadataTag(metadataTag, bean);
bean.source [metadataTag.host.name] = SwizLogger.getLogger(bean.source);
}
override public function tearDownMetadataTag(metadataTag:IMetadataTag, bean:Bean):void
{
super.tearDownMetadataTag(metadataTag,bean);
bean.source[metadataTag.host.name] = null;
}
}
}
精彩评论