예제 #1
0
 public void Start()
 {
     Thread Thread = new Thread(delegate ()
     {
         while (true)
         {
             if (Entries.Count == 0)
             {
                 if (!Running) break;
             }
             else
             {
                 Entry Entry = Entries.Dequeue();
                 if (LogLevel >= Entry.Level)
                 {
                     string Output = string.Format("{0} [{1}] {2}", Entry.Timestamp.ToShortTimeString(), Entry.Level, Entry.Content);
                     Console.WriteLine(Output);
                     if (LogFile != null) File.AppendAllText(LogFile, Output + Environment.NewLine);
                 }
             }
             Thread.Sleep(10);
         }
     });
     Thread.Start();
 }