From 3ef4bffaf959d06527a247faa19cc869781745e4 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 21 Nov 2021 21:21:46 -0800 Subject: Slightly improve logging on Windows The characters won't display properly if the system codepage isn't UTF-8, but at least it shouldn't cut the line off prematurely. --- core/logging.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/logging.cpp') diff --git a/core/logging.cpp b/core/logging.cpp index 91cb0e8c..7ee7ff23 100644 --- a/core/logging.cpp +++ b/core/logging.cpp @@ -35,10 +35,9 @@ void al_print(LogLevel level, FILE *logfile, const char *fmt, ...) va_end(args2); va_end(args); - std::wstring wstr{utf8_to_wstr(str)}; if(gLogLevel >= level) { - fputws(wstr.c_str(), logfile); + fputs(str, logfile); fflush(logfile); } /* OutputDebugStringW has no 'level' property to distinguish between @@ -46,6 +45,7 @@ void al_print(LogLevel level, FILE *logfile, const char *fmt, ...) * non-Release builds. */ #ifndef NDEBUG + std::wstring wstr{utf8_to_wstr(str)}; OutputDebugStringW(wstr.c_str()); #endif } -- cgit v1.2.3