Akka.Util.StandardOutWriter.WriteToConsole C# (CSharp) Method

WriteToConsole() private static method

private static WriteToConsole ( string message, ConsoleColor foregroundColor = null, ConsoleColor backgroundColor = null, bool line = true ) : void
message string
foregroundColor ConsoleColor
backgroundColor ConsoleColor
line bool
return void
        private static void WriteToConsole(string message, ConsoleColor? foregroundColor = null,
            ConsoleColor? backgroundColor = null, bool line = true)
        {
            lock (_lock)
            {
                ConsoleColor? fg = null;
                if (foregroundColor.HasValue)
                {
                    fg = Console.ForegroundColor;
                    Console.ForegroundColor = foregroundColor.Value;
                }
                ConsoleColor? bg = null;
                if (backgroundColor.HasValue)
                {
                    bg = Console.BackgroundColor;
                    Console.BackgroundColor = backgroundColor.Value;
                }
                if (line)
                    Console.WriteLine(message);
                else
                    Console.Write(message);
                if (fg.HasValue)
                {
                    Console.ForegroundColor = fg.Value;
                }
                if (bg.HasValue)
                {
                    Console.BackgroundColor = bg.Value;
                }
            }
        }
    }