本文整理汇总了C#中LogFactory.GetLogger方法的典型用法代码示例。如果您正苦于以下问题:C# LogFactory.GetLogger方法的具体用法?C# LogFactory.GetLogger怎么用?C# LogFactory.GetLogger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogFactory
的用法示例。
在下文中一共展示了LogFactory.GetLogger方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenericGetLoggerTest
public void GenericGetLoggerTest()
{
LogFactory<MyLogger> lf = new LogFactory<MyLogger>();
MyLogger l1 = lf.GetLogger("AAA");
MyLogger l2 = lf.GetLogger("AAA");
MyLogger l3 = lf.GetLogger("BBB");
Assert.Same(l1, l2);
Assert.NotSame(l1, l3);
Assert.Equal("AAA", l1.Name);
Assert.Equal("BBB", l3.Name);
}
示例2: TypedGetLoggerTest
public void TypedGetLoggerTest()
{
LogFactory lf = new LogFactory();
MyLogger l1 = (MyLogger)lf.GetLogger("AAA", typeof(MyLogger));
MyLogger l2 = (MyLogger)lf.GetLogger("AAA", typeof(MyLogger));
Logger l3 = lf.GetLogger("AAA", typeof(Logger));
Logger l4 = lf.GetLogger("AAA", typeof(Logger));
Logger l5 = lf.GetLogger("AAA");
Logger l6 = lf.GetLogger("AAA");
Assert.AreSame(l1, l2);
Assert.AreSame(l3, l4);
Assert.AreSame(l5, l6);
Assert.AreSame(l3, l5);
Assert.AreNotSame(l1, l3);
Assert.AreEqual("AAA", l1.Name);
Assert.AreEqual("AAA", l3.Name);
}
示例3: AssertMessageFormattedWithCulture
private void AssertMessageFormattedWithCulture(LoggingConfiguration configuration, CultureInfo culture, string formatString, params object[] parameters)
{
var expected = string.Format(culture, formatString, parameters);
using (var logFactory = new LogFactory(configuration))
{
var logger = logFactory.GetLogger("test");
logger.Debug(formatString, parameters);
Assert.Equal(expected, GetDebugLastMessage("debug", configuration));
}
}
示例4: GetLoggerWithoutType
public static void GetLoggerWithoutType()
{
var factory = new LogFactory();
factory.GetLogger("AAA");
}
示例5: GetLoggerWithType
public static void GetLoggerWithType()
{
var factory = new LogFactory();
factory.GetLogger("AAA", typeof(MyLogger));
}