add some colors to the windows console. feel free to change them/add bolding or whatever

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2676 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-03-18 17:51:09 +00:00
parent 2301d072a6
commit a110a8caef
1 changed files with 30 additions and 1 deletions

View File

@ -66,11 +66,40 @@ ConsoleListener::~ConsoleListener()
}
// Logs the message to screen
void ConsoleListener::Log(LogTypes::LOG_LEVELS, const char *text)
void ConsoleListener::Log(LogTypes::LOG_LEVELS level, const char *text)
{
#if defined(_WIN32)
DWORD cCharsWritten; // We will get a value back here
WORD color;
switch (level)
{
case ERROR_LEVEL: // red
color = FOREGROUND_RED | FOREGROUND_INTENSITY;
break;
case WARNING_LEVEL: // yellow
color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY;
break;
case NOTICE_LEVEL: // green
color = FOREGROUND_GREEN | FOREGROUND_INTENSITY;
break;
case INFO_LEVEL: // cyan
color = FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY;
break;
case DEBUG_LEVEL: // supposedly gray
color = FOREGROUND_INTENSITY | FOREGROUND_INTENSITY;
break;
default: // white
color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY;
break;
}
SetConsoleTextAttribute(m_hStdOut, color);
WriteConsole(m_hStdOut, text, (DWORD)strlen(text),
&cCharsWritten, NULL);