/// <summary> /// Write debug message to log /// </summary> /// <param name="text">The debug text to log</param> public void Debug(string text) { var log = new LogEntry(text, DateTime.Now, LogType.Debug); _logs.Enqueue(log); OnLogEvent(log); _trace.WriteLine(DateTime.Now.ToString(DateFormat) + " Debug:: " + text); }
/// <summary> /// Write error message to log /// </summary> /// <param name="text">The error text to log</param> public void Error(string text) { var log = new LogEntry(text, DateTime.Now, LogType.Error); _logs.Enqueue(log); OnLogEvent(log); Console.ForegroundColor = ConsoleColor.Red; _error.WriteLine(DateTime.Now.ToString(DateFormat) + " Error:: " + text); Console.ResetColor(); }
/// <summary> /// Raise a log event safely /// </summary> protected virtual void OnLogEvent(LogEntry log) { var handler = LogEvent; if (handler != null) { handler(log); } }