diff options
Diffstat (limited to 'alc/helpers.cpp')
-rw-r--r-- | alc/helpers.cpp | 79 |
1 files changed, 1 insertions, 78 deletions
diff --git a/alc/helpers.cpp b/alc/helpers.cpp index 1003ccfa..8c1c8562 100644 --- a/alc/helpers.cpp +++ b/alc/helpers.cpp @@ -35,7 +35,7 @@ #include "alspan.h" #include "alstring.h" #include "compat.h" -#include "logging.h" +#include "core/logging.h" #include "strutils.h" #include "vector.h" @@ -79,36 +79,6 @@ const PathNamePair &GetProcBinary() return ret; } - -void al_print(LogLevel level, FILE *logfile, const char *fmt, ...) -{ - al::vector<char> dynmsg; - char stcmsg[256]; - char *str{stcmsg}; - - va_list args, args2; - va_start(args, fmt); - va_copy(args2, args); - int msglen{std::vsnprintf(str, sizeof(stcmsg), fmt, args)}; - if UNLIKELY(msglen >= 0 && static_cast<size_t>(msglen) >= sizeof(stcmsg)) - { - dynmsg.resize(static_cast<size_t>(msglen) + 1u); - str = dynmsg.data(); - msglen = std::vsnprintf(str, dynmsg.size(), fmt, args2); - } - va_end(args2); - va_end(args); - - std::wstring wstr{utf8_to_wstr(str)}; - if(gLogLevel >= level) - { - fputws(wstr.c_str(), logfile); - fflush(logfile); - } - OutputDebugStringW(wstr.c_str()); -} - - namespace { void DirectorySearch(const char *path, const char *ext, al::vector<std::string> *const results) @@ -225,9 +195,6 @@ void SetRTPriority(void) #ifdef __HAIKU__ #include <FindDirectory.h> #endif -#ifdef __ANDROID__ -#include <android/log.h> -#endif #ifdef HAVE_PROC_PIDPATH #include <libproc.h> #endif @@ -323,50 +290,6 @@ const PathNamePair &GetProcBinary() return ret; } - -void al_print(LogLevel level, FILE *logfile, const char *fmt, ...) -{ - al::vector<char> dynmsg; - char stcmsg[256]; - char *str{stcmsg}; - - va_list args, args2; - va_start(args, fmt); - va_copy(args2, args); - int msglen{std::vsnprintf(str, sizeof(stcmsg), fmt, args)}; - if UNLIKELY(msglen >= 0 && static_cast<size_t>(msglen) >= sizeof(stcmsg)) - { - dynmsg.resize(static_cast<size_t>(msglen) + 1u); - str = dynmsg.data(); - msglen = std::vsnprintf(str, dynmsg.size(), fmt, args2); - } - va_end(args2); - va_end(args); - - if(gLogLevel >= level) - { - fputs(str, logfile); - fflush(logfile); - } -#ifdef __ANDROID__ - auto android_severity = [](LogLevel l) noexcept - { - switch(l) - { - case LogLevel::Trace: return ANDROID_LOG_DEBUG; - case LogLevel::Warning: return ANDROID_LOG_WARN; - case LogLevel::Error: return ANDROID_LOG_ERROR; - /* Should not happen. */ - case LogLevel::Disable: - break; - } - return ANDROID_LOG_ERROR; - }; - __android_log_print(android_severity(level), "openal", "%s", str); -#endif -} - - namespace { void DirectorySearch(const char *path, const char *ext, al::vector<std::string> *const results) |