Пример #1
0
 public override void LogRecord(LogRecord rec)
 {
     if (IsLevelEnabled(rec.Level))
     {
         _queue?.Append(rec);
     }
 }
Пример #2
0
 public override void LogRecord(LogRecord rec)
 {
     if (IsLevelEnabled(rec.Level))
     {
         if (Immediately)
         {
             RenderMessage(rec);
         }
         else
         {
             _queue?.Append(rec);
         }
     }
 }
Пример #3
0
        public void QueueProcessorTest010()
        {
            QueueProcessor <string> queue = new QueueProcessor <string>("string", str =>
            {
                Console.WriteLine($"{DateTime.Now} Renderer: {str}");
                Thread.Sleep(200);
            });

            for (int i = 0; i < 70; i++)
            {
                queue.Append($"Item {i}");
            }

            Thread.Sleep(2000);
            Console.WriteLine($"{DateTime.Now} dispose thread");
            queue.Dispose();
            Console.WriteLine($"{DateTime.Now} continue thread");
        }