From 032ed656f44bb85ad03474879fcfccdb3d12b44c Mon Sep 17 00:00:00 2001 From: XargonWan Date: Fri, 29 Nov 2024 10:54:01 +0900 Subject: [PATCH] When RetroDECK is defined the logs are written in the RetroDECK format --- es-core/src/Log.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/es-core/src/Log.cpp b/es-core/src/Log.cpp index 948973cde..f36b499bb 100644 --- a/es-core/src/Log.cpp +++ b/es-core/src/Log.cpp @@ -71,9 +71,20 @@ std::ostringstream& Log::get(LogLevel level) localtime_r(&t, &tm); #endif std::unique_lock lock {sLogMutex}; + +#if defined(RetroDECK) + // Convert log level to uppercase for RetroDECK + std::string levelUpper = mLogLevelMap[level]; + std::transform(levelUpper.begin(), levelUpper.end(), levelUpper.begin(), ::toupper); + + mOutStringStream << "[" << std::put_time(&tm, "%Y-%m-%d %H:%M:%S") + << "] [" << levelUpper << "] [ES-DE] "; +#else mOutStringStream << std::put_time(&tm, "%b %d %H:%M:%S ") << mLogLevelMap[level] << (level == LogLevel::LogInfo || level == LogLevel::LogWarning ? ": " : ": "); +#endif + mMessageLevel = level; return mOutStringStream;