本文整理汇总了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);
}
示例2: WrapperOverAgnostic
public void WrapperOverAgnostic()
{
Layout l = new SimpleLayout("${rot13:${message}}");
l.Initialize(null);
Assert.True(l.IsThreadAgnostic);
}
示例3: AgnosticPlusAgnostic
public void AgnosticPlusAgnostic()
{
Layout l = new SimpleLayout("${message}${level}${logger}");
l.Initialize(null);
Assert.True(l.IsThreadAgnostic);
}
示例4: AgnosticPlusNonAgnostic
public void AgnosticPlusNonAgnostic()
{
Layout l = new SimpleLayout("${message}${threadname}");
l.Initialize(null);
Assert.False(l.IsThreadAgnostic);
}
示例5: NonThreadAgnosticTest
public void NonThreadAgnosticTest()
{
Layout l = new SimpleLayout("${threadname}");
l.Initialize(null);
Assert.False(l.IsThreadAgnostic);
}
示例6: ThreadAgnosticTest
public void ThreadAgnosticTest()
{
Layout l = new SimpleLayout("${message}");
l.Initialize(null);
Assert.True(l.IsThreadAgnostic);
}
示例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);
}
示例8: TripleWrapperOverNonAgnostic
public void TripleWrapperOverNonAgnostic()
{
Layout l = new SimpleLayout("${uppercase:${lowercase:${rot13:${message}${threadname}}}}");
l.Initialize(null);
Assert.False(l.IsThreadAgnostic);
}
示例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);
}
示例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);
}
示例11: TripleWrapperOverAgnostic
public void TripleWrapperOverAgnostic()
{
Layout l = new SimpleLayout("${uppercase:${lowercase:${rot13:${message}}}}");
l.Initialize(CommonCfg);
Assert.IsTrue(l.IsThreadAgnostic);
}
示例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);
}