本文整理汇总了C#中ConsoleLogger.Info方法的典型用法代码示例。如果您正苦于以下问题:C# ConsoleLogger.Info方法的具体用法?C# ConsoleLogger.Info怎么用?C# ConsoleLogger.Info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConsoleLogger
的用法示例。
在下文中一共展示了ConsoleLogger.Info方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
private static void Main(string[] args)
{
// Automatically attached to Log Manager, and also sets it as the default logger to be used
// from LogManager.Log
var l = LogManager.CreateLogger<ColoredConsoleLogger>();
// Default level is Trace, on Debug builds, and Warn+Trace on Release.
LogManager.Logger.Level = LogLevel.Trace;
// Calling the default logger:
LogManager.Log("Hello");
LogManager.LogAsync("Log the same async.");
LogManager.Log(LogLevel.Critical, "This is critical!");
// Alternate ways:
// Exactly the same as above. This is how the above is implemented internally.
LogManager.Logger.Critical("LM: Critical");
LogManager.Logger.Error("LM: oops");
LogManager.Logger.Warn("LM: warning, warning!!");
LogManager.Logger.Info("LM: Hi!");
LogManager.Logger.Debug("LM: Some debug data.");
LogManager.Logger.Trace("LM: Yello");
l.Critical("DIRECT: This should work as well.");
var newLogger = new ConsoleLogger();
newLogger.Level = LogLevel.Trace;
newLogger.IsEnabled = true;
newLogger.Info("DIRECT: SayHi!");
LogManager.AttachLogger(newLogger, "new");
var oldConsoleLogger = LogManager.GetLogger("new");
oldConsoleLogger.Trace("INDIRECT: TRACE Info");
LogManager.DisableAll();
oldConsoleLogger.Info("INDIRECT: won't be printed..");
LogManager.EnableAll();
var cl = new CompositeLogger();
cl.Level = LogLevel.Trace;
cl.AttachTarget(oldConsoleLogger);
cl.Critical("COMPOSITE: hi from composite!");
cl.Info("COMPOSITE: Info");
oldConsoleLogger.Info("Bye bye!");
}
示例2: InfoLogger
public void InfoLogger()
{
ConsoleLogger log = new ConsoleLogger("Logger", LoggerLevel.Info);
log.Debug("Some debug message");
log.Info("Some info message");
log.Error("Some error message");
log.Fatal("Some fatal error message");
log.Warn("Some warn message");
String logcontents = outWriter.GetStringBuilder().ToString();
StringWriter expected = new StringWriter();
expected.WriteLine("[Info] 'Logger' Some info message");
expected.WriteLine("[Error] 'Logger' Some error message");
expected.WriteLine("[Fatal] 'Logger' Some fatal error message");
expected.WriteLine("[Warn] 'Logger' Some warn message");
Assert.AreEqual(expected.GetStringBuilder().ToString(), logcontents, "logcontents don't match");
}
示例3: ConsoleLogger
public void ConsoleLogger()
{
var logger = new ConsoleLogger();
logger.Info("Test");
}