mirror of
				https://github.com/RetroDECK/ES-DE.git
				synced 2025-04-10 19:15:13 +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
	
	 Leon Styhre
						Leon Styhre