aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-10-08 00:21:21 -0700
committerChris Robinson <[email protected]>2019-10-08 00:21:21 -0700
commitf4bc3d7ab22b90f725b7e80fbf2cb879b4729ed8 (patch)
tree3e1c479db7430f537603f32b33ac8de4607334dd
parent52a003e9bb7c870f26436b38e62edc96385805dc (diff)
Improve logging for Windows
-rw-r--r--alc/helpers.cpp2
-rw-r--r--alc/logging.h10
2 files changed, 6 insertions, 6 deletions
diff --git a/alc/helpers.cpp b/alc/helpers.cpp
index 2d532db1..0e2dc067 100644
--- a/alc/helpers.cpp
+++ b/alc/helpers.cpp
@@ -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);
}
diff --git a/alc/logging.h b/alc/logging.h
index 24cfda71..ec6023a5 100644
--- a/alc/logging.h
+++ b/alc/logging.h
@@ -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)