private static string GetLogLine(LogEntry entry) { return String.Format("[{0} | {1}]\t{2}\r\n", entry.date, entry.type, entry.msg); }
public static void Log(string message, EventType eventType) { LogEntry new_logEntry = new LogEntry(DateTime.Now, eventType, message); messages.Add(new_logEntry); try { logwriter.Write(GetLogLine(new_logEntry)); logwriter.Flush(); } catch (Exception) { //ignore it, because if you handle this error, the handler will again log the message //ErrorHandler.Handle(ex); } //Populate LogMessage to all subscribed Logger-Outputs, but only if not Debug message, Debug messages are only logged to logfile if (LogUpdated != null && eventType > EventType.Debug) LogUpdated(GetLogLine(new_logEntry)); }