public static void WriteLine(string line) { try { line = $"{ DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") } | { line }"; lock (logLock) { File.AppendAllLines(LogFile, new string[] { line }); } if (WriteToConsole) { Console.WriteLine(line); } if (Debugger.IsAttached) { Debug.WriteLine(line); } LogLineAdded?.Invoke(line); } catch (Exception ex) { ShowNotification?.Invoke(ex.ToString()); } }
protected void AddLogLine(string text) { lock (LogLines) LogLines.Add(text); LogLineAdded?.Invoke(this, EventArgs.Empty); }
public override void AddLogLine(LogLine line) { mLog.Enqueue(line); LogLineAdded?.Invoke(this, new EventArgs()); }