Esempio n. 1
0
        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++;
            }
        }
Esempio n. 2
0
        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();
                        }
                    }
                }
            }
        }
Esempio n. 3
0
 public void Append(LogStatement statement)
 {
     text.AppendLine(statement.ToString());
 }