本文整理汇总了C#中LogFactory.GetCurrentClassLogger方法的典型用法代码示例。如果您正苦于以下问题:C# LogFactory.GetCurrentClassLogger方法的具体用法?C# LogFactory.GetCurrentClassLogger怎么用?C# LogFactory.GetCurrentClassLogger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogFactory
的用法示例。
在下文中一共展示了LogFactory.GetCurrentClassLogger方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenericGetCurrentClassLoggerTest
public void GenericGetCurrentClassLoggerTest()
{
LogFactory<MyLogger> lf = new LogFactory<MyLogger>();
MyLogger l1 = lf.GetCurrentClassLogger();
MyLogger l2 = lf.GetCurrentClassLogger();
Assert.Same(l1, l2);
Assert.Equal("NLog.UnitTests.GetLoggerTests", l1.Name);
}
示例2: TypedGetCurrentClassLoggerTest
public void TypedGetCurrentClassLoggerTest()
{
LogFactory lf = new LogFactory();
MyLogger l1 = (MyLogger)lf.GetCurrentClassLogger(typeof(MyLogger));
MyLogger l2 = lf.GetCurrentClassLogger<MyLogger>();
ILogger l3 = lf.GetCurrentClassLogger(typeof(Logger));
ILogger l4 = lf.GetCurrentClassLogger<Logger>();
ILogger l5 = lf.GetCurrentClassLogger();
ILogger l6 = lf.GetCurrentClassLogger();
Assert.Same(l1, l2);
Assert.Same(l3, l4);
Assert.Same(l5, l6);
Assert.Same(l3, l5);
Assert.NotSame(l1, l3);
Assert.Equal("NLog.UnitTests.GetLoggerTests", l1.Name);
Assert.Equal("NLog.UnitTests.GetLoggerTests", l3.Name);
}
示例3: GetCurrentClassLoggerWithoutType
public static void GetCurrentClassLoggerWithoutType()
{
var factory = new LogFactory();
factory.GetCurrentClassLogger();
}
示例4: GetCurrentClassLoggerWithType
public static void GetCurrentClassLoggerWithType()
{
var factory = new LogFactory();
factory.GetCurrentClassLogger(typeof(MyLogger));
}