Windows error logs directed to stderr

(cherry picked from commit efef236e43)
This commit is contained in:
Thakee Nathees 2020-05-29 09:04:17 +05:30 committed by Rémi Verschelde
parent c7a0113a4b
commit 9c74452636
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 12 additions and 12 deletions

View File

@ -108,47 +108,47 @@ void WindowsTerminalLogger::log_error(const char *p_function, const char *p_file
SetConsoleTextAttribute(hCon, basecol | FOREGROUND_INTENSITY); SetConsoleTextAttribute(hCon, basecol | FOREGROUND_INTENSITY);
switch (p_type) { switch (p_type) {
case ERR_ERROR: case ERR_ERROR:
logf("ERROR:"); logf_error("ERROR:");
break; break;
case ERR_WARNING: case ERR_WARNING:
logf("WARNING:"); logf_error("WARNING:");
break; break;
case ERR_SCRIPT: case ERR_SCRIPT:
logf("SCRIPT ERROR:"); logf_error("SCRIPT ERROR:");
break; break;
case ERR_SHADER: case ERR_SHADER:
logf("SHADER ERROR:"); logf_error("SHADER ERROR:");
break; break;
} }
SetConsoleTextAttribute(hCon, basecol); SetConsoleTextAttribute(hCon, basecol);
if (p_rationale && p_rationale[0]) { if (p_rationale && p_rationale[0]) {
logf(" %s\n", p_rationale); logf_error(" %s\n", p_rationale);
} else { } else {
logf(" %s\n", p_code); logf_error(" %s\n", p_code);
} }
// `FOREGROUND_INTENSITY` alone results in gray text. // `FOREGROUND_INTENSITY` alone results in gray text.
SetConsoleTextAttribute(hCon, FOREGROUND_INTENSITY); SetConsoleTextAttribute(hCon, FOREGROUND_INTENSITY);
switch (p_type) { switch (p_type) {
case ERR_ERROR: case ERR_ERROR:
logf(" at: "); logf_error(" at: ");
break; break;
case ERR_WARNING: case ERR_WARNING:
logf(" at: "); logf_error(" at: ");
break; break;
case ERR_SCRIPT: case ERR_SCRIPT:
logf(" at: "); logf_error(" at: ");
break; break;
case ERR_SHADER: case ERR_SHADER:
logf(" at: "); logf_error(" at: ");
break; break;
} }
if (p_rationale && p_rationale[0]) { if (p_rationale && p_rationale[0]) {
logf("(%s:%i)\n", p_file, p_line); logf_error("(%s:%i)\n", p_file, p_line);
} else { } else {
logf("%s (%s:%i)\n", p_function, p_file, p_line); logf_error("%s (%s:%i)\n", p_function, p_file, p_line);
} }
SetConsoleTextAttribute(hCon, sbi.wAttributes); SetConsoleTextAttribute(hCon, sbi.wAttributes);