mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-26 08:05: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();
|
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 it's an error or the --debug flag has been set, then print to the console as well.
|
||||||
if (mMessageLevel == LogError || sReportingLevel >= LogDebug)
|
if (mMessageLevel == LogError || sReportingLevel >= LogDebug)
|
||||||
std::cerr << mOutStringStream.str();
|
std::cerr << mOutStringStream.str();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,10 @@
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
#if defined(__ANDROID__)
|
||||||
|
#include <android/log.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define LOG(level) \
|
#define LOG(level) \
|
||||||
if (level > Log::getReportingLevel()) \
|
if (level > Log::getReportingLevel()) \
|
||||||
; \
|
; \
|
||||||
|
|
Loading…
Reference in a new issue