private static void TestLogger(Logger_class log) { ILogger.Priority existing = log.DefaultLogLevel; log.DefaultLogLevel = ILogger.Priority.Medium; log.WriteLog("Testing overall log capability. I'll write five messages, one for each log level, with"); log.WriteLog("deescalating priorities."); log.WriteLog(); log.WriteLog("------------------------------------------------------------------"); log.WriteLog("Critical", ILogger.Priority.Critical); log.WriteLog("High", ILogger.Priority.High); log.WriteLog("Medium", ILogger.Priority.Medium); log.WriteLog("Low", ILogger.Priority.Low); log.WriteLog("Information", ILogger.Priority.Information); log.DefaultLogLevel = existing; }
public void WriteLog(string message = "", ILogger.Priority messagePriority = ILogger.Priority.Medium) { // immediate check against priority for speedy return; if the message is of lower priority, straight up reject message if (messagePriority < this.DefaultLogLevel) { return; } if (message.Equals(string.Empty)) { Console.WriteLine(); return; } if (messagePriority >= this.DefaultLogLevel) { Console.WriteLine(DateTime.Now.ToString() + ": " + message); } }