From f5e643bf34d90f70b4a0caa5aa491b23eff9751b Mon Sep 17 00:00:00 2001 From: hrydgard Date: Fri, 20 Mar 2009 21:41:03 +0000 Subject: [PATCH] neato line coloring (time in white, rest colored) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2702 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/ConsoleListener.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/Source/Core/Common/Src/ConsoleListener.cpp b/Source/Core/Common/Src/ConsoleListener.cpp index da2bee8c15..c26a389a73 100644 --- a/Source/Core/Common/Src/ConsoleListener.cpp +++ b/Source/Core/Common/Src/ConsoleListener.cpp @@ -15,6 +15,7 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ +#include // min #include // System: To be able to add strings with "+" #include #ifdef _WIN32 @@ -89,6 +90,10 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS level, const char *text) switch (level) { + case NOTICE_LEVEL: // light green + color = FOREGROUND_GREEN | FOREGROUND_INTENSITY; + break; + case ERROR_LEVEL: // light red color = FOREGROUND_RED | FOREGROUND_INTENSITY; break; @@ -97,24 +102,25 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS level, const char *text) color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY; break; - case NOTICE_LEVEL: // light green - color = FOREGROUND_GREEN | FOREGROUND_INTENSITY; - break; - case INFO_LEVEL: // cyan color = FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY; break; - case DEBUG_LEVEL: // light gray + case DEBUG_LEVEL: // gray color = FOREGROUND_INTENSITY; break; - default: // white - color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY; + default: // off-white + color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break; } + if (strlen(text) > 10) { + // first 10 chars white + SetConsoleTextAttribute(m_hStdOut, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY); + WriteConsole(m_hStdOut, text, 10, &cCharsWritten, NULL); + text += 10; + } SetConsoleTextAttribute(m_hStdOut, color); - WriteConsole(m_hStdOut, text, (DWORD)strlen(text), &cCharsWritten, NULL); #else fprintf(stderr, "%s", text);