Linux: Fix up console logging so it both doesn't insert newlines every time the color is changed, and doesn't log the color change codes in logs, as unless you are using a console based text editor, it's harder to read.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@832 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2009-03-22 09:14:53 +00:00
parent 3e3ffef417
commit 267d964126
1 changed files with 10 additions and 8 deletions

View File

@ -55,11 +55,11 @@ void Close()
__forceinline bool __fastcall Newline() __forceinline bool __fastcall Newline()
{ {
if (Config.PsxOut) if (Config.PsxOut)
puts("\n"); printf("\n");
if (emuLog != NULL) if (emuLog != NULL)
{ {
fputs("\n", emuLog); fprintf(emuLog,"\n");
fflush(emuLog); fflush(emuLog);
} }
@ -68,23 +68,25 @@ __forceinline bool __fastcall Newline()
__forceinline bool __fastcall Write(const char* fmt) __forceinline bool __fastcall Write(const char* fmt)
{ {
if (Config.PsxOut) // By using fputs, append a newline automatically.
fputs(fmt, stdout); if (Config.PsxOut) fputs(fmt, stdout);
if (emuLog != NULL) // Color changing should not use this function, as we don't want the color codes logged, or new lines inserted.
fputs(fmt, emuLog); if (emuLog != NULL) fputs(fmt, emuLog);
return false; return false;
} }
void __fastcall SetColor(Colors color) void __fastcall SetColor(Colors color)
{ {
Write(tbl_color_codes[color]); // Don't log the color change, and don't insert a new line afterwards.
printf(tbl_color_codes[color]);
} }
void ClearColor() void ClearColor()
{ {
Write(COLOR_RESET); // Don't log the color change, and don't insert a new line afterwards.
printf(COLOR_RESET);
} }
} }