Пример #1
0
        internal static void DoPublish()
        {
            ConsoleColor oldColor = Console.ForegroundColor;

            lock ( logList )
            {
                if (logList.Count > 0)
                {
                    int logsCount = logList.Count;

                    int pushAmt = (logsCount <= MAX_LOGS_PER_PUSH ? logsCount : MAX_LOGS_PER_PUSH);

                    for (int i = 0; i < pushAmt; i++)
                    {
                        ConsoleLog l = logList[i];
                        if (l != null)
                        {
                            Console.ForegroundColor = l.GetColor( );
                            Console.WriteLine("[NULL_CLASS]" + l.GetMessage());
                        }
                    }

                    if (pushAmt <= logsCount)
                    {
                        logList.Clear( );
                    }
                    else
                    {
                        logList.RemoveRange(0, pushAmt - 1);
                    }
                }
            }

            Console.ForegroundColor = oldColor;
        }