Improve logging for Windows

This commit is contained in:
Chris Robinson
2019-10-08 00:21:21 -07:00
parent 52a003e9bb
commit f4bc3d7ab2
2 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -305,7 +305,7 @@ void al_print(FILE *logfile, const char *fmt, ...)
va_end(args);
std::wstring wstr{utf8_to_wstr(str)};
fprintf(logfile, "%ls", wstr.c_str());
fputws(wstr.c_str(), logfile);
fflush(logfile);
}
+5 -5
View File
@@ -17,9 +17,9 @@ extern FILE *gLogFile;
void al_print(FILE *logfile, const char *fmt, ...) DECL_FORMAT(printf, 2,3);
#if !defined(_WIN32)
#define AL_PRINT(T, ...) fprintf(gLogFile, "AL lib: " T " " __VA_ARGS__)
#define AL_PRINT fprintf
#else
#define AL_PRINT(T, ...) al_print(gLogFile, "AL lib: " T " " __VA_ARGS__)
#define AL_PRINT al_print
#endif
#ifdef __ANDROID__
@@ -40,19 +40,19 @@ extern LogLevel gLogLevel;
#define TRACE(...) do { \
if UNLIKELY(gLogLevel >= LogTrace) \
AL_PRINT("(II)", __VA_ARGS__); \
AL_PRINT(gLogFile, "AL lib: (II) " __VA_ARGS__); \
LOG_ANDROID(ANDROID_LOG_DEBUG, __VA_ARGS__); \
} while(0)
#define WARN(...) do { \
if UNLIKELY(gLogLevel >= LogWarning) \
AL_PRINT("(WW)", __VA_ARGS__); \
AL_PRINT(gLogFile, "AL lib: (WW) " __VA_ARGS__); \
LOG_ANDROID(ANDROID_LOG_WARN, __VA_ARGS__); \
} while(0)
#define ERR(...) do { \
if UNLIKELY(gLogLevel >= LogError) \
AL_PRINT("(EE)", __VA_ARGS__); \
AL_PRINT(gLogFile, "AL lib: (EE) " __VA_ARGS__); \
LOG_ANDROID(ANDROID_LOG_ERROR, __VA_ARGS__); \
} while(0)