コード例 #1
0
 /// <summary>
 /// Creates node with specified configuration data.
 /// </summary>
 /// <param name="distributorSettings">The specified configuration data.</param>
 public DistributorSettingsNode(DistributorSettings distributorSettings)
     : base()
 {
     this.onDefaultCategoryNodeRemoved = new ConfigurationNodeChangedEventHandler(OnDefaultCategoryNodeRemoved);
     this.onDefaultCategoryNodeRenamed = new ConfigurationNodeChangedEventHandler(OnDefaultCategoryNodeRenamed);
     this.onDefaultFormatterNodeRemoved = new ConfigurationNodeChangedEventHandler(OnDefaultFormatterNodeRemoved);
     this.onDefaultFormatterNodeRenamed = new ConfigurationNodeChangedEventHandler(OnDefaultFormatterNodeRenamed);
     this.distributorSettings = distributorSettings;
 }
コード例 #2
0
        private static DistributorSettings GenerateDistributorSettings()
        {
            DistributorSettings result = new DistributorSettings();

            result.DefaultCategory="AppError" ;
            result.DefaultFormatter="XmlFormat";

            result.DistributorService = new MsmqDistributorServiceData("Enterprise Library Logging Distributor Service", @".\Private$\entlib", 1000 );

            result.SinkDataCollection.Add( new CustomSinkData("MockSink", typeof(MockLogSink).AssemblyQualifiedName ) );

            result.Formatters.Add( new TextFormatterData("XmlFormat", "<![CDATA[<EntLibLog>{newline}{tab}<message>{message}</message>{newline}{tab}<timestamp>{timestamp}</timestamp>{newline}{tab}<title>{title}</title>{newline}</EntLibLog>]]>"));

            CategoryData data = new CategoryData();
            data.Name = "AppError";
            data.DestinationDataCollection.Add( new DestinationData("MockSink", "MockSink"));
            result.CategoryDataCollection.Add(data);

            return result;
        }