• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Configuration.LoggingSettings类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings的典型用法代码示例。如果您正苦于以下问题:C# LoggingSettings类的具体用法?C# LoggingSettings怎么用?C# LoggingSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LoggingSettings类属于Microsoft.Practices.EnterpriseLibrary.Logging.Configuration命名空间,在下文中一共展示了LoggingSettings类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Arrange

        protected override void Arrange()
        {
            base.Arrange();

            IConfigurationSource source = new DictionaryConfigurationSource();
            ConfigurationSourceBuilder sourceBuiler = new ConfigurationSourceBuilder();

            sourceBuiler.ConfigureLogging()
                .WithOptions.DisableTracing()
                .DoNotRevertImpersonation()
                .FilterOnPriority("prio filter").StartingWithPriority(10)
                .FilterOnCategory("categoryFiler").AllowAllCategoriesExcept("cat1")
                .LogToCategoryNamed("General")
                .SendTo.EventLog("Event Log Listener")
                .FormatWith(new FormatterBuilder().TextFormatterNamed("Default"))
                .LogToCategoryNamed("Critical")
                .SendTo.SharedListenerNamed("Event Log Listener")
                .SendTo.Custom<MyCustomListener>("Custom Listener")
                .SendTo.Email("Email Listener")
                .SendTo.SystemDiagnosticsListener("system diagnostics")
                .LogToCategoryNamed("msmq")
                .SendTo.Msmq("msmq");

            sourceBuiler.UpdateConfigurationWithReplace(source);
            LoggingSection = (LoggingSettings)source.GetSection(LoggingSettings.SectionName);
        }
开发者ID:HondaBey,项目名称:EnterpriseLibrary6,代码行数:26,代码来源:LoggingConfigurationContext.cs


示例2: ValidateLoggingSettings

		private void ValidateLoggingSettings(LoggingSettings loggingSettings)
		{
			if (loggingSettings == null)
			{
				throw new System.Configuration.ConfigurationErrorsException(Resources.ExceptionLoggingSectionNotFound);
			}
		}
开发者ID:wuyingyou,项目名称:uniframework,代码行数:7,代码来源:LogWriterStructureHolderCustomFactory.cs


示例3: CanDeserializeSerializedConfiguration

		public void CanDeserializeSerializedConfiguration()
		{
			string name = "name";
			string write = "write";
			string add = "add";
			string database = "database";
			string formatter = "formatter";

			TraceListenerData data = new FormattedDatabaseTraceListenerData(name, write, add, database, formatter, TraceOptions.Callstack);

			LoggingSettings settings = new LoggingSettings();
			settings.TraceListeners.Add(data);

			IDictionary<string, ConfigurationSection> sections = new Dictionary<string, ConfigurationSection>();
			sections[LoggingSettings.SectionName] = settings;
			IConfigurationSource configurationSource
				= ConfigurationTestHelper.SaveSectionsInFileAndReturnConfigurationSource(sections);

			LoggingSettings roSettigs = (LoggingSettings)configurationSource.GetSection(LoggingSettings.SectionName);

			Assert.AreEqual(1, roSettigs.TraceListeners.Count);
			Assert.IsNotNull(roSettigs.TraceListeners.Get(name));
			Assert.AreEqual(TraceOptions.Callstack, roSettigs.TraceListeners.Get(name).TraceOutputOptions);
			Assert.AreSame(typeof(FormattedDatabaseTraceListenerData), roSettigs.TraceListeners.Get(name).GetType());
			Assert.AreSame(typeof(FormattedDatabaseTraceListenerData), roSettigs.TraceListeners.Get(name).ListenerDataType);
			Assert.AreSame(typeof(FormattedDatabaseTraceListener), roSettigs.TraceListeners.Get(name).Type);
			Assert.AreEqual(add, ((FormattedDatabaseTraceListenerData)roSettigs.TraceListeners.Get(name)).AddCategoryStoredProcName);
			Assert.AreEqual(database, ((FormattedDatabaseTraceListenerData)roSettigs.TraceListeners.Get(name)).DatabaseInstanceName);
			Assert.AreEqual(formatter, ((FormattedDatabaseTraceListenerData)roSettigs.TraceListeners.Get(name)).Formatter);
			Assert.AreEqual(write, ((FormattedDatabaseTraceListenerData)roSettigs.TraceListeners.Get(name)).WriteLogStoredProcName);
		}
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:31,代码来源:FormattedDatabaseTraceListenerConfigurationFixture.cs


示例4: Arrange

        protected override void Arrange()
        {
            base.Arrange();

            var builder = new ConfigurationSourceBuilder();
            builder.ConfigureLogging()
                        .LogToCategoryNamed("category")
                            .SendTo
                                .EventLog("listener")
                        .SpecialSources
                            .AllEventsCategory
                                .SendTo
                                    .EventLog("listener")
                        .SpecialSources
                            .LoggingErrorsAndWarningsCategory
                                .SendTo
                                    .EventLog("listener")
                        .SpecialSources
                            .UnprocessedCategory
                                .SendTo
                                    .EventLog("listener");


            var source = new DictionaryConfigurationSource();
            builder.UpdateConfigurationWithReplace(source);

            ElementLookup = Container.Resolve<ElementLookup>();
            LoggingSection = (LoggingSettings)source.GetSection(LoggingSettings.SectionName);
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:29,代码来源:when_adding_a_new_element.cs


示例5: CanDeserializeSerializedConfiguration

        public void CanDeserializeSerializedConfiguration()
        {
            string name = "name";
            string source = "source";
            string log = "log";
            string machine = "machine";
            string formatter = "formatter";

            TraceListenerData data = new FormattedEventLogTraceListenerData(name, source, log, machine,
                                                                            formatter, TraceOptions.Callstack);

            LoggingSettings settings = new LoggingSettings();
            settings.TraceListeners.Add(data);

            IDictionary<string, ConfigurationSection> sections = new Dictionary<string, ConfigurationSection>();
            sections[LoggingSettings.SectionName] = settings;
            IConfigurationSource configurationSource
                = ConfigurationTestHelper.SaveSectionsInFileAndReturnConfigurationSource(sections);

            LoggingSettings roSettigs = (LoggingSettings)configurationSource.GetSection(LoggingSettings.SectionName);

            Assert.AreEqual(1, roSettigs.TraceListeners.Count);
            Assert.IsNotNull(roSettigs.TraceListeners.Get(name));
            Assert.AreEqual(TraceOptions.Callstack, roSettigs.TraceListeners.Get(name).TraceOutputOptions);
            Assert.AreSame(typeof(FormattedEventLogTraceListenerData), roSettigs.TraceListeners.Get(name).GetType());
            Assert.AreSame(typeof(FormattedEventLogTraceListenerData), roSettigs.TraceListeners.Get(name).ListenerDataType);
            Assert.AreSame(typeof(FormattedEventLogTraceListener), roSettigs.TraceListeners.Get(name).Type);
            Assert.AreEqual(formatter, ((FormattedEventLogTraceListenerData)roSettigs.TraceListeners.Get(name)).Formatter);
            Assert.AreEqual(log, ((FormattedEventLogTraceListenerData)roSettigs.TraceListeners.Get(name)).Log);
            Assert.AreEqual(machine, ((FormattedEventLogTraceListenerData)roSettigs.TraceListeners.Get(name)).MachineName);
            Assert.AreEqual(source, ((FormattedEventLogTraceListenerData)roSettigs.TraceListeners.Get(name)).Source);
        }
开发者ID:HondaBey,项目名称:EnterpriseLibrary6,代码行数:32,代码来源:FormattedEventLogTraceListenerConfigurationFixture.cs


示例6: SetUp

		public void SetUp()
		{
			configurationSource = new DictionaryConfigurationSourceWithHandlersQuery();

			InstrumentationConfigurationSection instrumentationConfig = new InstrumentationConfigurationSection(true, true, true);
			configurationSource.Add(InstrumentationConfigurationSection.SectionName, instrumentationConfig);

			settings = new LoggingSettings();
			configurationSource.Add(LoggingSettings.SectionName, settings);

			settings.SpecialTraceSources.ErrorsTraceSource
				= new TraceSourceData("error", SourceLevels.Off);

			TraceSourceData traceSourceData = new TraceSourceData("blocking", SourceLevels.All);
			traceSourceData.TraceListeners.Add(new TraceListenerReferenceData("listener1"));
			settings.TraceSources.Add(traceSourceData);
			traceSourceData = new TraceSourceData("nonblocking", SourceLevels.All);
			traceSourceData.TraceListeners.Add(new TraceListenerReferenceData("listener2"));
			settings.TraceSources.Add(traceSourceData);

			TraceListenerData traceListenerData = new CustomTraceListenerData("listener1", typeof(MockBlockingCustomTraceListener), "init 1");
			settings.TraceListeners.Add(traceListenerData);
			traceListenerData = new MockTraceListenerData("listener2");
			settings.TraceListeners.Add(traceListenerData);

			reflectionCache = new ConfigurationReflectionCache();

			MockTraceListener.Reset();
			MockBlockingCustomTraceListener.Reset();
		}
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:30,代码来源:LogWriterSingletonManagementFixture.cs


示例7: CanDeserializeSerializedConfiguration

		public void CanDeserializeSerializedConfiguration()
		{
			string name = "name";
			string filename = "filename";
			string header = "header";
			string footer = "footer";
			string formatter = "formatter";

			TraceListenerData data = new FlatFileTraceListenerData(name, filename, header, footer,
													formatter, TraceOptions.Callstack);

			LoggingSettings settings = new LoggingSettings();
			settings.TraceListeners.Add(data);

			IDictionary<string, ConfigurationSection> sections = new Dictionary<string, ConfigurationSection>();
			sections[LoggingSettings.SectionName] = settings;
			IConfigurationSource configurationSource
				= ConfigurationTestHelper.SaveSectionsInFileAndReturnConfigurationSource(sections);

			LoggingSettings roSettigs = (LoggingSettings)configurationSource.GetSection(LoggingSettings.SectionName);

			Assert.AreEqual(1, roSettigs.TraceListeners.Count);
			Assert.IsNotNull(roSettigs.TraceListeners.Get(name));
			Assert.AreEqual(TraceOptions.Callstack, roSettigs.TraceListeners.Get(name).TraceOutputOptions);
			Assert.AreSame(typeof(FlatFileTraceListenerData), roSettigs.TraceListeners.Get(name).GetType());
			Assert.AreSame(typeof(FlatFileTraceListenerData), roSettigs.TraceListeners.Get(name).ListenerDataType);
			Assert.AreSame(typeof(FlatFileTraceListener), roSettigs.TraceListeners.Get(name).Type);
			Assert.AreEqual(filename, ((FlatFileTraceListenerData)roSettigs.TraceListeners.Get(name)).FileName);
			Assert.AreEqual(footer, ((FlatFileTraceListenerData)roSettigs.TraceListeners.Get(name)).Footer);
			Assert.AreEqual(formatter, ((FlatFileTraceListenerData)roSettigs.TraceListeners.Get(name)).Formatter);
			Assert.AreEqual(header, ((FlatFileTraceListenerData)roSettigs.TraceListeners.Get(name)).Header);
		}
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:32,代码来源:FormattedFlatFileTraceListenerConfigurationFixture.cs


示例8: CanDeserializeSerializedCollection

		public void CanDeserializeSerializedCollection()
		{
			LoggingSettings rwLoggingSettings = new LoggingSettings();
			rwLoggingSettings.TraceListeners.Add(new FormattedEventLogTraceListenerData("listener1", CommonUtil.EventLogSourceName, "formatter"));
			rwLoggingSettings.TraceListeners.Add(new SystemDiagnosticsTraceListenerData("listener2", typeof(FormattedEventLogTraceListener), CommonUtil.EventLogSourceName));
			rwLoggingSettings.TraceListeners.Add(new SystemDiagnosticsTraceListenerData("listener3", typeof(XmlWriterTraceListener), "foobar.txt"));

			ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
			fileMap.ExeConfigFilename = "test.exe.config";
			System.Configuration.Configuration rwConfiguration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
			rwConfiguration.Sections.Remove(LoggingSettings.SectionName);
			rwConfiguration.Sections.Add(LoggingSettings.SectionName, rwLoggingSettings);


			File.SetAttributes(fileMap.ExeConfigFilename, FileAttributes.Normal);
			rwConfiguration.Save();

			System.Configuration.Configuration roConfiguration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
			LoggingSettings roLoggingSettings = roConfiguration.GetSection(LoggingSettings.SectionName) as LoggingSettings;

			Assert.AreEqual(3, roLoggingSettings.TraceListeners.Count);

			Assert.IsNotNull(roLoggingSettings.TraceListeners.Get("listener1"));
			Assert.AreEqual(roLoggingSettings.TraceListeners.Get("listener1").GetType(), typeof(FormattedEventLogTraceListenerData));
			Assert.AreSame(roLoggingSettings.TraceListeners.Get("listener1").Type, typeof(FormattedEventLogTraceListener));

			Assert.IsNotNull(roLoggingSettings.TraceListeners.Get("listener2"));
			Assert.AreEqual(roLoggingSettings.TraceListeners.Get("listener2").GetType(), typeof(SystemDiagnosticsTraceListenerData));
			Assert.AreSame(roLoggingSettings.TraceListeners.Get("listener2").Type, typeof(FormattedEventLogTraceListener));

			Assert.IsNotNull(roLoggingSettings.TraceListeners.Get("listener3"));
			Assert.AreEqual(roLoggingSettings.TraceListeners.Get("listener3").GetType(), typeof(SystemDiagnosticsTraceListenerData));
			Assert.AreSame(roLoggingSettings.TraceListeners.Get("listener3").Type, typeof(XmlWriterTraceListener));
		}
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:34,代码来源:TraceListenerDataCollectionFixture.cs


示例9: CanDeserializeSerializedConfiguration

		public void CanDeserializeSerializedConfiguration()
		{
			LoggingSettings rwLoggingSettings = new LoggingSettings();
			rwLoggingSettings.TraceListeners.Add(
                new EmailTraceListenerData("listener", "[email protected]", "[email protected]", "EntLib-Logging:",
                                                    "has occurred", "smtphost", 25, "formatter"));
            rwLoggingSettings.TraceListeners.Add(
                new EmailTraceListenerData("listener2", "[email protected]", "[email protected]", "EntLib-Logging:",
                                                    "has occurred", "smtphost", 25, "formatter"));

			ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
			fileMap.ExeConfigFilename = "test.exe.config";
			System.Configuration.Configuration rwConfiguration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
			rwConfiguration.Sections.Remove(LoggingSettings.SectionName);
			rwConfiguration.Sections.Add(LoggingSettings.SectionName, rwLoggingSettings);


			File.SetAttributes(fileMap.ExeConfigFilename, FileAttributes.Normal);				
			rwConfiguration.Save();

			System.Configuration.Configuration roConfiguration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
			LoggingSettings roLoggingSettings = roConfiguration.GetSection(LoggingSettings.SectionName) as LoggingSettings;

			Assert.AreEqual(2, roLoggingSettings.TraceListeners.Count);
			Assert.IsNotNull(roLoggingSettings.TraceListeners.Get("listener"));
			Assert.IsNotNull(roLoggingSettings.TraceListeners.Get("listener2"));
		}
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:27,代码来源:FormatterEmailTraceListenerConfigurationFixture.cs


示例10: SetUp

 public void SetUp()
 {
     loggingSettings = new LoggingSettings();
     connectionStringsSection = new ConnectionStringsSection();
     configurationSource = new DictionaryConfigurationSource();
     configurationSource.Add(LoggingSettings.SectionName, loggingSettings);
     configurationSource.Add("connectionStrings", connectionStringsSection);
 }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:8,代码来源:FormattedDatabaseTraceListenerPolicyCreatorFixture.cs


示例11: GetLoggingSettings

        ConfigurationSection GetLoggingSettings()
        {
            LoggingSettings loggingConfiguration = null;

            if (!_cache.ContainsKey(LoggingSettingsKey))
            {
                lock (_sync)
                {
                    if (!_cache.ContainsKey(LoggingSettingsKey))
                    {
                        loggingConfiguration = new LoggingSettings();

                        loggingConfiguration.Name = "Logging Application Block";
                        loggingConfiguration.TracingEnabled = true;
                        loggingConfiguration.DefaultCategory = "General";
                        loggingConfiguration.LogWarningWhenNoCategoriesMatch = true;

                        var customTraceListenerData = new CustomTraceListenerData
                                                          {
                                                              ListenerDataType =
                                                                  Type.GetType(
                                                                  "Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.CustomTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"),
                                                              TraceOutputOptions = TraceOptions.None,
                                                              Filter = SourceLevels.All,
                                                              Type =
                                                                  Type.GetType(
                                                                  "NCommons.Logging.EnterpriseLibrary.Specs.TraceListenerSpy, NCommons.Logging.EnterpriseLibrary.Specs"),
                                                              Name = "Custom Trace Listener",
                                                              Formatter = "Text Formatter"
                                                          };

                        loggingConfiguration.TraceListeners.Add(customTraceListenerData);

                        var textFormatterData = new TextFormatterData
                                                    {
                                                        Name = "Text Formatter",
                                                        Type =
                                                            Type.GetType(
                                                            "Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"),
                                                        Template = "{message}"
                                                    };

                        loggingConfiguration.Formatters.Add(textFormatterData);

                        loggingConfiguration.SpecialTraceSources.AllEventsTraceSource.TraceListeners.Add(
                            new TraceListenerReferenceData("Custom Trace Listener"));
                        loggingConfiguration.SpecialTraceSources.AllEventsTraceSource.DefaultLevel =
                            SourceLevels.All;
                        loggingConfiguration.SpecialTraceSources.AllEventsTraceSource.Name = "All Events";

                        _cache[LoggingSettingsKey] = loggingConfiguration;
                    }
                }
            }

            return _cache[LoggingSettingsKey];
        }
开发者ID:bsommardahl,项目名称:ncommons,代码行数:57,代码来源:ConfigurationSourceStub.cs


示例12: SetUp

        public void SetUp()
        {
            instrumentationSettings = new InstrumentationConfigurationSection(true, true);
            loggingSettings = new LoggingSettings();
            configurationSource = new DictionaryConfigurationSource();
            configurationSource.Add(LoggingSettings.SectionName, loggingSettings);

            container = new UnityContainer();
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:9,代码来源:LoggingBlockExtensionFixture.cs


示例13: ConfigureLogging

        /// <summary>
        /// Main entry point to configuration a <see cref="LoggingSettings"/> section.
        /// </summary>
        /// <param name="configurationSourceBuilder">The builder interface to extend.</param>
        /// <returns></returns>
        public static ILoggingConfigurationStart ConfigureLogging(this IConfigurationSourceBuilder configurationSourceBuilder)
        {
            if(configurationSourceBuilder == null) throw new ArgumentNullException("configurationSourceBuilder");

            LoggingSettings loggingSettings = new LoggingSettings();
            configurationSourceBuilder.AddSection(LoggingSettings.SectionName, loggingSettings);

            return new LoggingConfigurationBuilder(loggingSettings);
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:14,代码来源:LoggingConfigurationSourceBuilderExtensions.cs


示例14: LogImplementation

 public LogImplementation(SourceLevels level)
 {
     var factory = new LoggingConfigurationSourceFactory();
     var configurationSource = factory.Create(level);
     this.entLibSettings =
         configurationSource.GetSection(EntLib.LoggingSettings.SectionName)
         as EntLib.LoggingSettings;
     this.logWriter = new LogWriterFactory(configurationSource).Create();
     this.loggingEnabled = true;
 }
开发者ID:paulkearney,项目名称:brnkly,代码行数:10,代码来源:LogImplementation.cs


示例15: CanCreateInstanceFromConfigurationFile

        public void CanCreateInstanceFromConfigurationFile()
        {
            LoggingSettings loggingSettings = new LoggingSettings();
            loggingSettings.TraceListeners.Add(
                    new WmiTraceListenerData("listener"));

            TraceListener listener = TraceListenerCustomFactory.Instance.Create(context, "listener", CommonUtil.SaveSectionsAndGetConfigurationSource(loggingSettings), reflectionCache);

            Assert.IsNotNull(listener);
            Assert.AreEqual(listener.GetType(), typeof(WmiTraceListener));
        }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:11,代码来源:WmiTraceListenerConfigurationFixture.cs


示例16: CanCreateInstanceFromConfigurationFile

        public void CanCreateInstanceFromConfigurationFile()
        {
            LoggingSettings loggingSettings = new LoggingSettings();
            loggingSettings.TraceListeners.Add(new SystemDiagnosticsTraceListenerData("listener", typeof(EventLogTraceListener), "Entlib Tests"));

            TraceListener listener = TraceListenerCustomFactory.Instance.Create(context, "listener", CommonUtil.SaveSectionsAndGetConfigurationSource(loggingSettings), reflectionCache);

            Assert.IsNotNull(listener);
            Assert.AreEqual(listener.GetType(), typeof(EventLogTraceListener));
            Assert.AreEqual("Entlib Tests", ((EventLogTraceListener)listener).EventLog.Source);
        }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:11,代码来源:EventLogTraceListenerConfigurationFixture.cs


示例17: LoggingSectionViewModel

        public LoggingSectionViewModel(IUnityContainer builder, string sectionName, ConfigurationSection section)
            : base(builder, sectionName, section)
        {
            if (section as LoggingSettings == null) throw new ArgumentException("section");

            loggingSettings = section as LoggingSettings;

            loggingSettings.SpecialTraceSources.AllEventsTraceSource.Name = "All Events";
            loggingSettings.SpecialTraceSources.ErrorsTraceSource.Name = "Logging Errors & Warnings";
            loggingSettings.SpecialTraceSources.NotProcessedTraceSource.Name = "Unprocessed Category";
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:11,代码来源:LoggingSectionViewModel.cs


示例18: CreateLoggingSettings

        private EntLib.LoggingSettings CreateLoggingSettings(SourceLevels level)
        {
            var entLibSettings = new EntLib.LoggingSettings();

            this.AddFormatters(entLibSettings);
            this.AddEventLogTraceListener(entLibSettings);
            this.AddApplicationCategorySource(entLibSettings);
            this.AddSpecialSources(level, entLibSettings);

            return entLibSettings;
        }
开发者ID:paulkearney,项目名称:brnkly,代码行数:11,代码来源:LoggingConfigurationSourceFactory.cs


示例19: CanCreateInstanceFromConfigurationFile

        public void CanCreateInstanceFromConfigurationFile()
        {
            LoggingSettings loggingSettings = new LoggingSettings();
            loggingSettings.TraceListeners.Add(new SystemDiagnosticsTraceListenerData("listener", typeof(EventLogTraceListener), "Entlib Tests"));

            TraceListener listener =
                GetListener("listener\u200cimplementation", CommonUtil.SaveSectionsAndGetConfigurationSource(loggingSettings));

            Assert.IsNotNull(listener);
            Assert.AreEqual(listener.GetType(), typeof(EventLogTraceListener));
            Assert.AreEqual("Entlib Tests", ((EventLogTraceListener)listener).EventLog.Source);
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:12,代码来源:EventLogTraceListenerConfigurationFixture.cs


示例20: WhenCreatingListener_ThenCreatesListenerWithSingleArgConstructor

        public void WhenCreatingListener_ThenCreatesListenerWithSingleArgConstructor()
        {
            var settings = new LoggingSettings { };

            var listener = (MockSystemDiagsTraceListener)listenerData.BuildTraceListener(settings);

            Assert.IsNotNull(listener);
            Assert.AreEqual("custom trace listener", listener.Name);
            Assert.AreSame("someInitData", listener.Value);
            Assert.AreEqual(TraceOptions.None, listener.TraceOutputOptions);
            Assert.IsNull(listener.Filter);
            Assert.AreEqual(0, listener.Attributes.Count);
        }
开发者ID:HondaBey,项目名称:EnterpriseLibrary6,代码行数:13,代码来源:CustomTraceListenerDataFixture.cs



注:本文中的Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Formatters.EventTextFormatter类代码示例发布时间:2022-05-26
下一篇:
C# Logging.LogWriter类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap