Menu


Выделение цветом текста в консольном приложении

2013-02-08 150949

static void LogGreen(string eventText)
{
var text = "[ConsoleService] " + eventText;
logger.Log(LogLevel.Info, text);
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("[Info] " + text);
Console.ResetColor();
}

static void LogRed(string eventText)
{
var text = "[ConsoleService] " + eventText;
logger.Log(LogLevel.Error, "[LyncServiceCore] " + eventText);
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("[ERROR] " + text);
Console.ResetColor();
}

static void LogYellow(string eventText)
{
var text = "[ConsoleService] " + eventText;
logger.Log(LogLevel.Warn, "[LyncServiceCore] " + eventText);
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("[Warning] " + text);
Console.ResetColor();
}

Войти or Sign In