private void LogThread(ThreadController controller) { while (true) { if (commandsQueue.Count > 0) { var command = commandsQueue.Dequeue(); switch (command.LogDestination) { case ELogDestination.File: PrintToFile(command.Message); break; case ELogDestination.Console: PrintToConsole(command.Message); break; case ELogDestination.All: PrintToConsole(command.Message); PrintToFile(command.Message); break; } } else { controller.Pause(); } } }