本文整理汇总了C#中Logger.Fatal方法的典型用法代码示例。如果您正苦于以下问题:C# Logger.Fatal方法的具体用法?C# Logger.Fatal怎么用?C# Logger.Fatal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logger
的用法示例。
在下文中一共展示了Logger.Fatal方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main()
{
ILayout simpleLayout = new SimpleLayout();
IAppender consoleAppender = new ConsoleAppender(simpleLayout);
var fileAppender = new FileAppender(simpleLayout);
fileAppender.File = "../../log.txt";
var logger = new Logger(consoleAppender, fileAppender);
logger.Error("Error parsing JSON.");
logger.Info(string.Format("User {0} successfully registered.", "Dobri"));
logger.Warn("Warning - missing files.");
var xmlLayout = new XmlLayout();
consoleAppender = new ConsoleAppender(xmlLayout);
logger = new Logger(consoleAppender);
logger.Fatal("mscorlib.dll does not respond");
logger.Critical("No connection string found in App.config");
consoleAppender = new ConsoleAppender(simpleLayout);
consoleAppender.ReportLevel = ReportLevel.Error;
logger = new Logger(consoleAppender);
logger.Info("Everything seems fine");
logger.Warn("Warning: ping is too high - disconnect imminent");
logger.Error("Error parsing request");
logger.Critical("No connection string found in App.config");
logger.Fatal("mscorlib.dll does not respond");
}
示例2: TestXmlLayuot
private static void TestXmlLayuot()
{
var xmlLayout = new XmlLayuot();
var consoleAppender = new ConsoleAppender(xmlLayout);
var logger = new Logger(consoleAppender);
logger.Fatal("mscorlib.dll does not respond");
logger.Critical("No connection string found in App.config");
}
示例3: Main
static void Main(string[] args)
{
ILayout simpleLayout = new SimpleLayout();
IAppender consoleAppender = new ConsoleAppender(simpleLayout);
consoleAppender.ReportLevel = ReportLevel.Error;
ILogger logger = new Logger(consoleAppender);
logger.Info("Everything seems fine");
logger.Warn("Warning: ping is too high - disconnect imminent");
logger.Error("Error parsing request");
logger.Critical("No connection string found in App.config");
logger.Fatal("mscorlib.dll does not respond");
}
示例4: TestTreshold
private static void TestTreshold()
{
var simpleLayout = new SimpleLayuot();
var consoleAppender = new ConsoleAppender(simpleLayout);
consoleAppender.Treshold = ReportLevel.Error;
var logger = new Logger(consoleAppender);
logger.Info("Everything seems fine");
logger.Warn("Warning: ping is too high - disconnect imminent");
logger.Error("Error parsing request");
logger.Critical("No connection string found in App.config");
logger.Fatal("mscorlib.dll does not respond");
}
示例5: Main
public static void Main()
{
try
{
var simpleLayout = new SimpleLayout();
var xmlLayout = new XmlLayout();
IAppender consoleAppender = new ConsoleAppender(simpleLayout);
IAppender fileAppender = new FileAppender(simpleLayout);
fileAppender.File = "../../log.txt";
IAppender fileAppenderXml = new FileAppender(xmlLayout);
fileAppenderXml.File = "../../log.xml";
ILogger logger = new Logger(consoleAppender, fileAppender, fileAppenderXml);
// add in logs
logger.Error("Error parsing JSON.");
logger.Info(string.Format("User {0} successfully registered.", "Pesho"));
logger.Warn("Warn - missing files.");
logger.Fatal("mscorlib.dll does not respond");
logger.Critical("No connection string found in App.config");
logger.Info("Everything seems fine");
logger.Warn("Warning: ping is too high - disconnect imminent");
logger.Error("Error parsing request");
logger.Critical("No connection string found in App.config");
logger.Fatal("mscorlib.dll does not respond");
}
catch (ArgumentException ex)
{
Console.WriteLine(ex.Message);
}
Console.WriteLine();
}
示例6: Main
public static void Main()
{
var simpleLayout = new SimpleLayout();
var jsonLayout = new JsonLayout();
// var myLayout = new SoftUniLayout();
var consoleAppender = new ConsoleAppender(simpleLayout);
consoleAppender.ReportLevel = ReportLevel.Error;
consoleAppender.ReportLevel = ReportLevel.Error;
var fileAppender = new FileAppendder(jsonLayout, "../../Log.txt");
fileAppender.ReportLevel = ReportLevel.Error;
var logger = new Logger(consoleAppender, fileAppender);
logger.Error("Error parsing JSON.");
logger.Warning("User John successfully registered");
logger.Info("Everything seems fine");
logger.Warning("Warning: ping is too high - disconnect imminent");
logger.Error("Error parsing request");
logger.Critical("No connection string found in App.config");
logger.Fatal("mscorlib.dll does not respond");
fileAppender.Close();
}
示例7: PassEmptyStringParameterToLoggerFatal_ThrowException
public void PassEmptyStringParameterToLoggerFatal_ThrowException()
{
var logger = new Logger(new ConsoleAppender(new SimpleLayout()));
logger.Fatal(" ");
}
示例8: PassNullParameterToLoggerFatal_ThrowException
public void PassNullParameterToLoggerFatal_ThrowException()
{
var logger = new Logger(new ConsoleAppender(new SimpleLayout()));
logger.Fatal(null);
}