mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 14:15:38 +00:00
(Android) Added log output support
This commit is contained in:
parent
27be4007a2
commit
c8d9d100cf
|
@ -91,7 +91,21 @@ Log::~Log()
|
|||
|
||||
sFile << mOutStringStream.str();
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
if (mMessageLevel == LogError) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, nullptr, "%s", mOutStringStream.str().c_str());
|
||||
}
|
||||
else if (sReportingLevel >= LogDebug) {
|
||||
if (mMessageLevel == LogInfo)
|
||||
__android_log_print(ANDROID_LOG_INFO, nullptr, "%s", mOutStringStream.str().c_str());
|
||||
else if (mMessageLevel == LogWarning)
|
||||
__android_log_print(ANDROID_LOG_WARN, nullptr, "%s", mOutStringStream.str().c_str());
|
||||
else
|
||||
__android_log_print(ANDROID_LOG_DEBUG, nullptr, "%s", mOutStringStream.str().c_str());
|
||||
}
|
||||
#else
|
||||
// If it's an error or the --debug flag has been set, then print to the console as well.
|
||||
if (mMessageLevel == LogError || sReportingLevel >= LogDebug)
|
||||
std::cerr << mOutStringStream.str();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -19,6 +19,10 @@
|
|||
#include <mutex>
|
||||
#include <sstream>
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
#include <android/log.h>
|
||||
#endif
|
||||
|
||||
#define LOG(level) \
|
||||
if (level > Log::getReportingLevel()) \
|
||||
; \
|
||||
|
|
Loading…
Reference in a new issue