mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 07:35:38 +00:00
(Android) Added the application ID to the log output
Also changed the general log output formatting slightly
This commit is contained in:
parent
b2e9507b0e
commit
84534cf5d7
|
@ -286,6 +286,7 @@ endif()
|
||||||
|
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
set(BUNDLED_CERTS ON)
|
set(BUNDLED_CERTS ON)
|
||||||
|
add_compile_definitions(ANDROID_APPLICATION_ID="org.es_de.frontend")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
|
|
@ -1,20 +1,15 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
//
|
//
|
||||||
// EmulationStation Desktop Edition (ES-DE) is a frontend for browsing
|
// ES-DE is a frontend for browsing and launching games from your multi-platform game collection.
|
||||||
// and launching games from your multi-platform game collection.
|
|
||||||
//
|
|
||||||
// Originally created by Alec Lofquist.
|
|
||||||
// Improved and extended by the RetroPie community.
|
|
||||||
// Desktop Edition fork by Leon Styhre.
|
|
||||||
//
|
//
|
||||||
// The column limit is 100 characters.
|
// The column limit is 100 characters.
|
||||||
// All ES-DE C++ source code is formatted using clang-format.
|
// All ES-DE C++ source code is formatted using clang-format.
|
||||||
//
|
//
|
||||||
// main.cpp
|
// main.cpp
|
||||||
//
|
//
|
||||||
// Main program loop. Interprets command-line arguments, checks for the
|
// Main program loop. Interprets command-line arguments, checks for the home folder
|
||||||
// home folder and es_settings.xml configuration file, sets up the application
|
// and es_settings.xml configuration file, sets up the application environment and
|
||||||
// environment and starts listening to SDL events.
|
// starts listening to SDL events.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "ApplicationUpdater.h"
|
#include "ApplicationUpdater.h"
|
||||||
|
@ -452,7 +447,7 @@ bool checkApplicationHomeDirectory()
|
||||||
std::cout << "First startup, creating application home directory \""
|
std::cout << "First startup, creating application home directory \""
|
||||||
<< Utils::String::replace(applicationHome, "/", "\\") << "\"\n";
|
<< Utils::String::replace(applicationHome, "/", "\\") << "\"\n";
|
||||||
#elif defined(__ANDROID__)
|
#elif defined(__ANDROID__)
|
||||||
__android_log_print(ANDROID_LOG_VERBOSE, nullptr,
|
__android_log_print(ANDROID_LOG_VERBOSE, ANDROID_APPLICATION_ID,
|
||||||
"First startup, creating application home directory \"%s\"",
|
"First startup, creating application home directory \"%s\"",
|
||||||
applicationHome.c_str());
|
applicationHome.c_str());
|
||||||
#else
|
#else
|
||||||
|
@ -462,7 +457,7 @@ bool checkApplicationHomeDirectory()
|
||||||
Utils::FileSystem::createDirectory(applicationHome);
|
Utils::FileSystem::createDirectory(applicationHome);
|
||||||
if (!Utils::FileSystem::exists(applicationHome)) {
|
if (!Utils::FileSystem::exists(applicationHome)) {
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
__android_log_print(ANDROID_LOG_ERROR, nullptr,
|
__android_log_print(ANDROID_LOG_ERROR, ANDROID_APPLICATION_ID,
|
||||||
"Error: Couldn't create directory, permission problems?");
|
"Error: Couldn't create directory, permission problems?");
|
||||||
#else
|
#else
|
||||||
std::cerr << "Error: Couldn't create directory, permission problems?\n";
|
std::cerr << "Error: Couldn't create directory, permission problems?\n";
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
//
|
//
|
||||||
// EmulationStation Desktop Edition
|
// ES-DE
|
||||||
// Log.cpp
|
// Log.cpp
|
||||||
//
|
//
|
||||||
// Log output.
|
// Log output.
|
||||||
|
@ -70,7 +70,9 @@ std::ostringstream& Log::get(LogLevel level)
|
||||||
localtime_r(&t, &tm);
|
localtime_r(&t, &tm);
|
||||||
#endif
|
#endif
|
||||||
std::unique_lock<std::mutex> lock {sLogMutex};
|
std::unique_lock<std::mutex> lock {sLogMutex};
|
||||||
mOutStringStream << std::put_time(&tm, "%b %d %H:%M:%S ") << mLogLevelMap[level] << ":\t";
|
mOutStringStream << std::put_time(&tm, "%b %d %H:%M:%S ") << mLogLevelMap[level]
|
||||||
|
<< (level == LogLevel::LogInfo || level == LogLevel::LogWarning ? ": " :
|
||||||
|
": ");
|
||||||
mMessageLevel = level;
|
mMessageLevel = level;
|
||||||
|
|
||||||
return mOutStringStream;
|
return mOutStringStream;
|
||||||
|
@ -85,9 +87,10 @@ Log::~Log()
|
||||||
// Not open yet, print to stdout.
|
// Not open yet, print to stdout.
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
__android_log_print(
|
__android_log_print(
|
||||||
ANDROID_LOG_ERROR, nullptr,
|
ANDROID_LOG_ERROR, ANDROID_APPLICATION_ID,
|
||||||
"Error: Tried to write to log file before it was open, the following won't be logged:");
|
"Error: Tried to write to log file before it was open, the following won't be logged:");
|
||||||
__android_log_print(ANDROID_LOG_ERROR, nullptr, "%s", mOutStringStream.str().c_str());
|
__android_log_print(ANDROID_LOG_ERROR, ANDROID_APPLICATION_ID, "%s",
|
||||||
|
mOutStringStream.str().c_str());
|
||||||
#else
|
#else
|
||||||
std::cerr << "Error: Tried to write to log file before it was open, "
|
std::cerr << "Error: Tried to write to log file before it was open, "
|
||||||
"the following won't be logged:\n";
|
"the following won't be logged:\n";
|
||||||
|
@ -100,15 +103,19 @@ Log::~Log()
|
||||||
|
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
if (mMessageLevel == LogError) {
|
if (mMessageLevel == LogError) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, nullptr, "%s", mOutStringStream.str().c_str());
|
__android_log_print(ANDROID_LOG_ERROR, ANDROID_APPLICATION_ID, "%s",
|
||||||
|
mOutStringStream.str().c_str());
|
||||||
}
|
}
|
||||||
else if (sReportingLevel >= LogDebug) {
|
else if (sReportingLevel >= LogDebug) {
|
||||||
if (mMessageLevel == LogInfo)
|
if (mMessageLevel == LogInfo)
|
||||||
__android_log_print(ANDROID_LOG_INFO, nullptr, "%s", mOutStringStream.str().c_str());
|
__android_log_print(ANDROID_LOG_INFO, ANDROID_APPLICATION_ID, "%s",
|
||||||
|
mOutStringStream.str().c_str());
|
||||||
else if (mMessageLevel == LogWarning)
|
else if (mMessageLevel == LogWarning)
|
||||||
__android_log_print(ANDROID_LOG_WARN, nullptr, "%s", mOutStringStream.str().c_str());
|
__android_log_print(ANDROID_LOG_WARN, ANDROID_APPLICATION_ID, "%s",
|
||||||
|
mOutStringStream.str().c_str());
|
||||||
else
|
else
|
||||||
__android_log_print(ANDROID_LOG_DEBUG, nullptr, "%s", mOutStringStream.str().c_str());
|
__android_log_print(ANDROID_LOG_DEBUG, ANDROID_APPLICATION_ID, "%s",
|
||||||
|
mOutStringStream.str().c_str());
|
||||||
}
|
}
|
||||||
#else
|
#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.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
//
|
//
|
||||||
// EmulationStation Desktop Edition
|
// ES-DE
|
||||||
// Log.h
|
// Log.h
|
||||||
//
|
//
|
||||||
// Log output.
|
// Log output.
|
||||||
|
|
Loading…
Reference in a new issue