mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-12-04 20:05:38 +00:00
LOG: def + include fixes
Some checks failed
Build ES-DE / Building_RetroDECK-ES-DE (push) Has been cancelled
Some checks failed
Build ES-DE / Building_RetroDECK-ES-DE (push) Has been cancelled
This commit is contained in:
parent
1a1d70ce9f
commit
330dd1d647
|
@ -11,6 +11,10 @@
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
#include "utils/StringUtil.h"
|
#include "utils/StringUtil.h"
|
||||||
|
|
||||||
|
#if defined(RETRODECK)
|
||||||
|
#include <algorithm>
|
||||||
|
#endif
|
||||||
|
|
||||||
LogLevel Log::getReportingLevel()
|
LogLevel Log::getReportingLevel()
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lock {sLogMutex};
|
std::unique_lock<std::mutex> lock {sLogMutex};
|
||||||
|
@ -25,7 +29,7 @@ void Log::setReportingLevel(LogLevel level)
|
||||||
|
|
||||||
void Log::init()
|
void Log::init()
|
||||||
{
|
{
|
||||||
#if defined(RetroDECK)
|
#if defined(RETRODECK)
|
||||||
// Check for the rd_logs_folder environment variable
|
// Check for the rd_logs_folder environment variable
|
||||||
const char* logFolder = std::getenv("rd_logs_folder");
|
const char* logFolder = std::getenv("rd_logs_folder");
|
||||||
if (logFolder && std::strlen(logFolder) > 0)
|
if (logFolder && std::strlen(logFolder) > 0)
|
||||||
|
@ -86,7 +90,7 @@ std::ostringstream& Log::get(LogLevel level)
|
||||||
#endif
|
#endif
|
||||||
std::unique_lock<std::mutex> lock {sLogMutex};
|
std::unique_lock<std::mutex> lock {sLogMutex};
|
||||||
|
|
||||||
#if defined(RetroDECK)
|
#if defined(RETRODECK)
|
||||||
// Convert log level to uppercase for RetroDECK
|
// Convert log level to uppercase for RetroDECK
|
||||||
std::string levelUpper = mLogLevelMap[level];
|
std::string levelUpper = mLogLevelMap[level];
|
||||||
std::transform(levelUpper.begin(), levelUpper.end(), levelUpper.begin(), ::toupper);
|
std::transform(levelUpper.begin(), levelUpper.end(), levelUpper.begin(), ::toupper);
|
||||||
|
@ -149,14 +153,14 @@ Log::~Log()
|
||||||
std::cerr << mOutStringStream.str();
|
std::cerr << mOutStringStream.str();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(RetroDECK)
|
#if defined(RETRODECK)
|
||||||
// Always write logs to the terminal as well when RetroDECK is defined
|
// Always write logs to the terminal as well when RetroDECK is defined
|
||||||
std::cout << mOutStringStream.str();
|
std::cout << mOutStringStream.str();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// RetroDECK specific function
|
// RetroDECK specific function
|
||||||
#if defined(RetroDECK)
|
#if defined(RETRODECK)
|
||||||
void Log::setReportingLevelFromEnv()
|
void Log::setReportingLevelFromEnv()
|
||||||
{
|
{
|
||||||
// Check for the logging_level environment variable
|
// Check for the logging_level environment variable
|
||||||
|
|
|
@ -53,6 +53,10 @@ public:
|
||||||
static void flush();
|
static void flush();
|
||||||
static void close();
|
static void close();
|
||||||
|
|
||||||
|
#if defined(RETRODECK)
|
||||||
|
static void setReportingLevelFromEnv();
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::ostringstream mOutStringStream;
|
std::ostringstream mOutStringStream;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue