Esempio n. 1
0
        private static void ProcessConsoleLogItem()
        {
            foreach (var item in ConsoleLogQueue.GetConsumingEnumerable())
            {
                Object thing = item.Item1;
                Nullable <ConsoleColor> color     = item.Item2;
                LogVerbosity            verbosity = item.Item3;
                bool writeLine = item.Item4;

                if (color != null && color.HasValue)
                {
                    WriteToConsoleLog(thing, color.Value, verbosity, writeLine);
                }
                else
                {
                    if (thing is Object[])
                    {
                        WriteToConsoleLog(thing as object[], verbosity);
                    }
                    else
                    {
                        WriteToConsoleLog(thing, verbosity, writeLine);
                    }
                }
            }
        }
Esempio n. 2
0
 public static void StopConsoleLogThread()
 {
     ConsoleLogQueue.CompleteAdding();
     ConsoleLoggingThread.Join(500);
     ConsoleLoggingThread.Abort();
     _consoleLogEnabled = false;
 }
Esempio n. 3
0
 private static void AddToConsoleLogQueue(Object thing, Nullable <ConsoleColor> color = null, LogVerbosity verbosity = LogVerbosity.Normal, bool writeLine = true)
 {
     if (_consoleLogEnabled && ShouldDisplay(verbosity))
     {
         ConsoleLogQueue.Add(new Tuple <object, Nullable <ConsoleColor>, LogVerbosity, bool>(thing, color, verbosity, writeLine));
     }
 }
Esempio n. 4
0
 public void LogConsole(string message)
 {
     if (bLogConsole)
     {
         ConsoleLogQueue.Enqueue(message);
         Console.Write(message);
     }
 }
Esempio n. 5
0
        public void WaitForLoggingCompletion()
        {
            while (ConsoleLogQueue.Any() ||
                   ErrorLogQueue.Any() ||
                   FailedEndpointsLogQueue.Any() ||
                   ResponseLogQueue.Any() ||
                   PerformanceLogQueue.Any())
            {
                Thread.Sleep(10);
            }

            WriteAllLogs();
        }