public void TestLogLevel() { var database = new InMemoryDatabaseProvider(); TheLog.FilterThreshold = LogLevel.Trace; TheLog.AddProvider(database, LogLevel.Trace); TheLog.Trace("Test"); Assert.AreEqual(LogLevel.Trace, database.Messages[database.Messages.Count - 1].LogMessage.LogLevel); TheLog.Debug("Test"); Assert.AreEqual(LogLevel.Debug, database.Messages[database.Messages.Count - 1].LogMessage.LogLevel); TheLog.Info("Test"); Assert.AreEqual(LogLevel.Info, database.Messages[database.Messages.Count - 1].LogMessage.LogLevel); TheLog.Warn("Test"); Assert.AreEqual(LogLevel.Warn, database.Messages[database.Messages.Count - 1].LogMessage.LogLevel); TheLog.Error("Test"); Assert.AreEqual(LogLevel.Error, database.Messages[database.Messages.Count - 1].LogMessage.LogLevel); TheLog.Fatal("Test"); Assert.AreEqual(LogLevel.Fatal, database.Messages[database.Messages.Count - 1].LogMessage.LogLevel); }
private static void Main() { // Initializes the log TheLog.FilterThreshold = LogLevel.Trace; TheLog.AddProvider(new ConsoleProvider(), LogLevel.Error); TheLog.AddProvider(new FileProvider("maednlog.txt", true)); for (var n = 0; n < 1000; n++) { // Runs the game var gameLogic = new MaednLogic(new MaednConfiguration { NumberOfPlayers = 4 }); gameLogic.Run(); } TheLog.Fatal("Done"); Console.ReadKey(); }
static void Main(string[] args) { TheLog.AddProvider(new ConsoleProvider(), LogLevel.Trace); TheLog.AddProvider(new FileProvider("test.log", true), LogLevel.Info); TheLog.Trace("Not added"); Thread.Sleep(100); TheLog.Debug("This is a debug message"); Thread.Sleep(80); TheLog.Info("We have an info message."); Thread.Sleep(80); TheLog.Warn("We have a warn"); Thread.Sleep(80); TheLog.Error("Error Occured...."); Thread.Sleep(80); TheLog.Fatal("We have to quit the application due to loss of O²."); Thread.Sleep(80); new WorkingMan().Work(); System.Console.WriteLine("Press key"); System.Console.ReadKey(); }