当前位置: 首页>>代码示例>>C#>>正文


C# SimpleLayout.Initialize方法代码示例

本文整理汇总了C#中NLog.Layouts.SimpleLayout.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# SimpleLayout.Initialize方法的具体用法?C# SimpleLayout.Initialize怎么用?C# SimpleLayout.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NLog.Layouts.SimpleLayout的用法示例。


在下文中一共展示了SimpleLayout.Initialize方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LayoutRendererThrows

 public void LayoutRendererThrows()
 {
     ConfigurationItemFactory configurationItemFactory = new ConfigurationItemFactory();
     configurationItemFactory.LayoutRenderers.RegisterDefinition("throwsException", typeof(ThrowsExceptionRenderer));
     var cfg = new LoggingConfiguration(configurationItemFactory);
     SimpleLayout l = new SimpleLayout("xx${throwsException}yy", cfg);
     l.Initialize(cfg);
     string output = l.Render(LogEventInfo.CreateNullEvent());
     Assert.AreEqual("xxyy", output);
 }
开发者ID:ExM,项目名称:NLog,代码行数:10,代码来源:SimpleLayoutOutputTests.cs

示例2: WrapperOverAgnostic

 public void WrapperOverAgnostic()
 {
     Layout l = new SimpleLayout("${rot13:${message}}");
     l.Initialize(null);
     Assert.True(l.IsThreadAgnostic);
 }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:6,代码来源:ThreadAgnosticTests.cs

示例3: AgnosticPlusAgnostic

 public void AgnosticPlusAgnostic()
 {
     Layout l = new SimpleLayout("${message}${level}${logger}");
     l.Initialize(null);
     Assert.True(l.IsThreadAgnostic);
 }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:6,代码来源:ThreadAgnosticTests.cs

示例4: AgnosticPlusNonAgnostic

 public void AgnosticPlusNonAgnostic()
 {
     Layout l = new SimpleLayout("${message}${threadname}");
     l.Initialize(null);
     Assert.False(l.IsThreadAgnostic);
 }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:6,代码来源:ThreadAgnosticTests.cs

示例5: NonThreadAgnosticTest

 public void NonThreadAgnosticTest()
 {
     Layout l = new SimpleLayout("${threadname}");
     l.Initialize(null);
     Assert.False(l.IsThreadAgnostic);
 }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:6,代码来源:ThreadAgnosticTests.cs

示例6: ThreadAgnosticTest

 public void ThreadAgnosticTest()
 {
     Layout l = new SimpleLayout("${message}");
     l.Initialize(null);
     Assert.True(l.IsThreadAgnostic);
 }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:6,代码来源:ThreadAgnosticTests.cs

示例7: CustomAgnosticTests

        public void CustomAgnosticTests()
        {
            var cif = new ConfigurationItemFactory();
            cif.RegisterType(typeof(CustomRendererAgnostic), string.Empty);

            Layout l = new SimpleLayout("${customAgnostic}", cif);

            l.Initialize(null);
            Assert.True(l.IsThreadAgnostic);
        }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:10,代码来源:ThreadAgnosticTests.cs

示例8: TripleWrapperOverNonAgnostic

 public void TripleWrapperOverNonAgnostic()
 {
     Layout l = new SimpleLayout("${uppercase:${lowercase:${rot13:${message}${threadname}}}}");
     l.Initialize(null);
     Assert.False(l.IsThreadAgnostic);
 }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:6,代码来源:ThreadAgnosticTests.cs

示例9: SimpleLayoutCachingTest

 public void SimpleLayoutCachingTest()
 {
     var l = new SimpleLayout("xx${level}yy");
     var ev = LogEventInfo.CreateNullEvent();
     l.Initialize(CommonCfg);
     string output1 = l.Render(ev);
     string output2 = l.Render(ev);
     Assert.AreSame(output1, output2);
 }
开发者ID:ExM,项目名称:NLog,代码行数:9,代码来源:SimpleLayoutOutputTests.cs

示例10: LayoutRendererThrows2

        public void LayoutRendererThrows2()
        {
            string internalLogOutput = RunAndCaptureInternalLog(
                () =>
                    {
                        ConfigurationItemFactory configurationItemFactory = new ConfigurationItemFactory();
                        configurationItemFactory.LayoutRenderers.RegisterDefinition("throwsException", typeof(ThrowsExceptionRenderer));

                        SimpleLayout l = new SimpleLayout("xx${throwsException:msg1}yy${throwsException:msg2}zz", new LoggingConfiguration(configurationItemFactory));
                        l.Initialize(CommonCfg);
                        string output = l.Render(LogEventInfo.CreateNullEvent());
                        Assert.AreEqual("xxyyzz", output);
                    },
                    LogLevel.Warn);

            Assert.IsTrue(internalLogOutput.IndexOf("msg1") >= 0, internalLogOutput);
            Assert.IsTrue(internalLogOutput.IndexOf("msg2") >= 0, internalLogOutput);
        }
开发者ID:ExM,项目名称:NLog,代码行数:18,代码来源:SimpleLayoutOutputTests.cs

示例11: TripleWrapperOverAgnostic

 public void TripleWrapperOverAgnostic()
 {
     Layout l = new SimpleLayout("${uppercase:${lowercase:${rot13:${message}}}}");
     l.Initialize(CommonCfg);
     Assert.IsTrue(l.IsThreadAgnostic);
 }
开发者ID:ExM,项目名称:NLog,代码行数:6,代码来源:ThreadAgnosticTests.cs

示例12: CustomNotAgnosticTests

        public void CustomNotAgnosticTests()
        {
            var cif = new ConfigurationItemFactory();
            cif.RegisterType(typeof(CustomRendererNonAgnostic), string.Empty);
            var cfg = new LoggingConfiguration(cif);
            Layout l = new SimpleLayout("${customNotAgnostic}", cfg);

            l.Initialize(cfg);
            Assert.IsFalse(l.IsThreadAgnostic);
        }
开发者ID:ExM,项目名称:NLog,代码行数:10,代码来源:ThreadAgnosticTests.cs


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