diff options
author | Chris Robinson <[email protected]> | 2019-06-18 22:57:48 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-06-18 22:57:48 -0700 |
commit | 0fa984027c37e6ae9f5acbfd013cba5ba90ea9aa (patch) | |
tree | 7c4980e9f8918fcec314402cfcf1b98b6492c8a5 /Alc | |
parent | 706df72d1813272e6cdfe817cf4c0adfefa13bd9 (diff) |
Simplify al_print
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/helpers.cpp | 13 | ||||
-rw-r--r-- | Alc/logging.h | 4 |
2 files changed, 8 insertions, 9 deletions
diff --git a/Alc/helpers.cpp b/Alc/helpers.cpp index 9236e57a..3efa989d 100644 --- a/Alc/helpers.cpp +++ b/Alc/helpers.cpp @@ -477,7 +477,7 @@ void *GetSymbol(void *handle, const char *name) } -void al_print(const char *type, const char *fmt, ...) +void al_print(FILE *logfile, const char *fmt, ...) { al::vector<char> dynmsg; char stcmsg[256]; @@ -497,8 +497,8 @@ void al_print(const char *type, const char *fmt, ...) va_end(args); std::wstring wstr{utf8_to_wstr(str)}; - fprintf(gLogFile, "AL lib: %s %ls", type, wstr.c_str()); - fflush(gLogFile); + fprintf(logfile, "%ls", wstr.c_str()); + fflush(logfile); } @@ -713,16 +713,15 @@ void *GetSymbol(void *handle, const char *name) #endif /* HAVE_DLFCN_H */ -void al_print(const char *type, const char *fmt, ...) +void al_print(FILE *logfile, const char *fmt, ...) { va_list ap; va_start(ap, fmt); - fprintf(gLogFile, "AL lib: %s ", type); - vfprintf(gLogFile, fmt, ap); + vfprintf(logfile, fmt, ap); va_end(ap); - fflush(gLogFile); + fflush(logfile); } diff --git a/Alc/logging.h b/Alc/logging.h index b5faf698..0bb0c87b 100644 --- a/Alc/logging.h +++ b/Alc/logging.h @@ -15,11 +15,11 @@ 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__) #else -void al_print(const char *type, const char *fmt, ...) DECL_FORMAT(printf, 2,3); -#define AL_PRINT(T, ...) al_print((T), __VA_ARGS__) +#define AL_PRINT(T, ...) al_print(gLogFile, "AL lib: " T " " __VA_ARGS__) #endif #ifdef __ANDROID__ |