public void Update(LogStatement statement) { if (statement.LogLevel == LogLevel.Trace) { totalTRC++; } if (statement.LogLevel == LogLevel.Debug) { totalDBG++; } if (statement.LogLevel == LogLevel.Info) { totalINF++; } if (statement.LogLevel == LogLevel.Warning) { totalWRN++; } if (statement.LogLevel == LogLevel.Error) { totalERR++; } if (statement.LogLevel == LogLevel.Fatal) { totalERF++; } }
private void ReadCurrentFile() { using (StreamReader reader = File.OpenText(logConfig.GetFullPath(fileIndex))) { lock (parsingLock) { parsing = true; } Thread loadingBarThread = new Thread(new ThreadStart(LoadingBar)); bool running = true; loadingBarThread.Start(); while (running) { LogStatement statement = new LogStatement(reader.ReadLine()); if (statement.LogLevel == LogLevel.Unknown) { logBuffer.Last().Append(statement); } else { logStats.Update(statement); logBuffer.Add(statement); } if (reader.EndOfStream) { lock (parsingLock) { parsing = false; running = false; DisplayProgress(); } } } } }
public void Append(LogStatement statement) { text.AppendLine(statement.ToString()); }