在Enterprise Library 5.0 + Silverlight中实例化和配置记录器

时间:2012-05-11 12:35:34

标签: silverlight enterprise-library

我在Silverlight项目中使用Enterprise Library 5.0,Logging block。 在项目中,我希望能够实例化一个记录器,我相信正确的类是LogWriterImpl。 我还希望能够使用Xml配置来配置这个LogWriterImpl,所以最后我想要这样的东西:

public class LoggerFactory
{
    public LoggerWriter Create(string xmlFilePath)
    {
        // Load configuration from xmlFilePath
        ???

        // Read the configuration and create the parameters for the LogWritterImpl
        ???

        // In Silverlight there are several constructors for the LogWritterImpl class
        // which one to use? which arguments to use?
        var logger = new LogWritterImpl( /* which parameters go here? */ );

        return logger;
    }
}

任何人都可以帮助我填补空白吗?

感谢您的时间!

1 个答案:

答案 0 :(得分:0)

参见本演练: http://channel9.msdn.com/posts/Enterprise-Library-for-Silverlight-Logging-demo

演示的源代码是here

另请参阅开发人员指南的this chapter