Changed log levels from numbers to text.

This commit is contained in:
Leon Styhre 2020-07-26 23:30:45 +02:00
parent 329a8da441
commit b5485b4ca9
21 changed files with 73 additions and 69 deletions

View file

@ -286,10 +286,10 @@ Starting EmulationStation with the --debug flag will provide feedback on whether
Example debug output: Example debug output:
``` ```
Jul 12 11:28:58 lvl3: Sound::getFromTheme(): Looking for navigation sound tag <sound name="quicksysselect">. Jul 12 11:28:58 Debug: Sound::getFromTheme(): Looking for navigation sound tag <sound name="quicksysselect">.
Jul 12 11:28:58 lvl3: Sound::getFromTheme(): Tag found, ready to load theme sound file. Jul 12 11:28:58 Debug: Sound::getFromTheme(): Tag found, ready to load theme sound file.
Jul 12 11:28:58 lvl3: Sound::getFromTheme(): Looking for navigation sound tag <sound name="select">. Jul 12 11:28:58 Debug: Sound::getFromTheme(): Looking for navigation sound tag <sound name="select">.
Jul 12 11:28:58 lvl3: Sound::getFromTheme(): Tag not found, using fallback sound file. Jul 12 11:28:58 Debug: Sound::getFromTheme(): Tag not found, using fallback sound file.
``` ```

View file

@ -148,7 +148,7 @@ void CollectionSystemManager::saveCustomCollection(SystemData* sys)
} }
} }
else { else {
LOG(LogError) << "Error - Couldn't find collection to save! " << name; LOG(LogError) << "Couldn't find collection to save! " << name;
} }
} }

View file

@ -379,7 +379,7 @@ void FileData::sort(ComparisonFunction& comparator, bool ascending)
std::vector<FileData*> mChildrenShown; std::vector<FileData*> mChildrenShown;
for (unsigned int i = 0; i < mChildren.size(); i++) { for (unsigned int i = 0; i < mChildren.size(); i++) {
if (mChildren[i]->getHidden()) { if (mChildren[i]->getHidden()) {
LOG(LogDebug) << "Debug - FileData::sort(): Skipping hidden game '" << LOG(LogDebug) << "FileData::sort(): Skipping hidden game '" <<
mChildren[i]->getName() << "'"; mChildren[i]->getName() << "'";
continue; continue;
} }
@ -420,7 +420,7 @@ void FileData::sortFavoritesOnTop(ComparisonFunction& comparator, bool ascending
for (unsigned int i = 0; i < mChildren.size(); i++) { for (unsigned int i = 0; i < mChildren.size(); i++) {
// Exclude game if it's marked as hidden and the hide setting has been set. // Exclude game if it's marked as hidden and the hide setting has been set.
if (!showHiddenGames && mChildren[i]->getHidden()) { if (!showHiddenGames && mChildren[i]->getHidden()) {
LOG(LogDebug) << "Debug - FileData::sortFavoritesOnTop(): Skipping hidden game '" << LOG(LogDebug) << "FileData::sortFavoritesOnTop(): Skipping hidden game '" <<
mChildren[i]->getName() << "'"; mChildren[i]->getName() << "'";
continue; continue;
} }

View file

@ -128,7 +128,7 @@ void parseGamelist(SystemData* system)
relativeTo, false); relativeTo, false);
if (!trustGamelist && !Utils::FileSystem::exists(path)) { if (!trustGamelist && !Utils::FileSystem::exists(path)) {
LOG(LogWarning) << "Warning - File \"" << path << "\" does not exist, ignoring."; LOG(LogWarning) << "File \"" << path << "\" does not exist, ignoring.";
continue; continue;
} }

View file

@ -101,8 +101,8 @@ bool SystemData::populateFolder(FileData* folder)
return false; return false;
} }
if (!Utils::FileSystem::isDirectory(folderPath)) { if (!Utils::FileSystem::isDirectory(folderPath)) {
LOG(LogWarning) << "Warning - Folder with path \"" << LOG(LogWarning) << "Folder with path \"" <<
folderPath << "\" is not a directory!"; folderPath << "\" is not a directory.";
return false; return false;
} }
@ -111,7 +111,7 @@ bool SystemData::populateFolder(FileData* folder)
// If this symlink resolves to somewhere that's at the beginning of our // If this symlink resolves to somewhere that's at the beginning of our
// path, it's going to create a recursive loop. Make sure to avoid this. // path, it's going to create a recursive loop. Make sure to avoid this.
if (folderPath.find(Utils::FileSystem::getCanonicalPath(folderPath)) == 0) { if (folderPath.find(Utils::FileSystem::getCanonicalPath(folderPath)) == 0) {
LOG(LogWarning) << "Warning - Skipping infinitely recursive symlink \"" << LOG(LogWarning) << "Skipping infinitely recursive symlink \"" <<
folderPath << "\""; folderPath << "\"";
return false; return false;
} }
@ -219,7 +219,7 @@ bool SystemData::loadConfig()
LOG(LogInfo) << "Loading system config file " << path << "..."; LOG(LogInfo) << "Loading system config file " << path << "...";
if (!Utils::FileSystem::exists(path)) { if (!Utils::FileSystem::exists(path)) {
LOG(LogWarning) << "Warning - es_systems.cfg does not exist."; LOG(LogWarning) << "es_systems.cfg does not exist.";
if (copyConfigTemplate(getConfigPath(true))) if (copyConfigTemplate(getConfigPath(true)))
return false; return false;
path = getConfigPath(false); path = getConfigPath(false);
@ -233,7 +233,7 @@ bool SystemData::loadConfig()
#endif #endif
if (!res) { if (!res) {
LOG(LogError) << "Error - Could not parse es_systems.cfg"; LOG(LogError) << "Could not parse es_systems.cfg";
LOG(LogError) << res.description(); LOG(LogError) << res.description();
return false; return false;
} }
@ -242,7 +242,7 @@ bool SystemData::loadConfig()
pugi::xml_node systemList = doc.child("systemList"); pugi::xml_node systemList = doc.child("systemList");
if (!systemList) { if (!systemList) {
LOG(LogError) << "Error - es_systems.cfg is missing the <systemList> tag!"; LOG(LogError) << "es_systems.cfg is missing the <systemList> tag.";
return false; return false;
} }
@ -288,7 +288,7 @@ bool SystemData::loadConfig()
// If there appears to be an actual platform ID supplied // If there appears to be an actual platform ID supplied
// but it didn't match the list, generate a warning. // but it didn't match the list, generate a warning.
if (str != nullptr && str[0] != '\0' && platformId == PlatformIds::PLATFORM_UNKNOWN) if (str != nullptr && str[0] != '\0' && platformId == PlatformIds::PLATFORM_UNKNOWN)
LOG(LogWarning) << "Warning - Unknown platform for system \"" << name << LOG(LogWarning) << "Unknown platform for system \"" << name <<
"\" (platform \"" << str << "\" from list \"" << platformList << "\")"; "\" (platform \"" << str << "\" from list \"" << platformList << "\")";
else if (platformId != PlatformIds::PLATFORM_UNKNOWN) else if (platformId != PlatformIds::PLATFORM_UNKNOWN)
platformIds.push_back(platformId); platformIds.push_back(platformId);
@ -299,8 +299,8 @@ bool SystemData::loadConfig()
// Validate. // Validate.
if (name.empty() || path.empty() || extensions.empty() || cmd.empty()) { if (name.empty() || path.empty() || extensions.empty() || cmd.empty()) {
LOG(LogError) << "Error - System \"" << name << LOG(LogError) << "System \"" << name <<
"\" is missing name, path, extension, or command!"; "\" is missing name, path, extension, or command.";
continue; continue;
} }
@ -363,7 +363,7 @@ bool SystemData::copyConfigTemplate(const std::string& path)
#endif #endif
if (Utils::FileSystem::copyFile(systemsTemplateFile, path, false)) { if (Utils::FileSystem::copyFile(systemsTemplateFile, path, false)) {
LOG(LogError) << "Error - Copying of es_systems.cfg template file failed."; LOG(LogError) << "Copying of es_systems.cfg template file failed.";
return true; return true;
} }

View file

@ -347,7 +347,7 @@ bool verifyHomeFolderExists()
bool loadSystemConfigFile(std::string& errorMsg) bool loadSystemConfigFile(std::string& errorMsg)
{ {
if (!SystemData::loadConfig()) { if (!SystemData::loadConfig()) {
LOG(LogError) << "Error - Could not parse systems configuration file."; LOG(LogError) << "Could not parse systems configuration file.";
errorMsg = "COULDN'T FIND THE SYSTEMS CONFIGURATION FILE.\n" errorMsg = "COULDN'T FIND THE SYSTEMS CONFIGURATION FILE.\n"
"ATTEMPTED TO COPY A TEMPLATE ES_SYSTEMS.CFG FILE\n" "ATTEMPTED TO COPY A TEMPLATE ES_SYSTEMS.CFG FILE\n"
"FROM THE EMULATIONSTATION RESOURCES DIRECTORY,\n" "FROM THE EMULATIONSTATION RESOURCES DIRECTORY,\n"
@ -358,7 +358,7 @@ bool loadSystemConfigFile(std::string& errorMsg)
} }
if (SystemData::sSystemVector.size() == 0) { if (SystemData::sSystemVector.size() == 0) {
LOG(LogError) << "Error - No systems found, does at least one system have a game present? " LOG(LogError) << "No systems found, does at least one system have a game present? "
"(Check that the file extensions are supported.)"; "(Check that the file extensions are supported.)";
errorMsg = "THE SYSTEMS CONFIGURATION FILE EXISTS, BUT NO\n" errorMsg = "THE SYSTEMS CONFIGURATION FILE EXISTS, BUT NO\n"
"GAME FILES WERE FOUND. PLEASE MAKE SURE THAT\n" "GAME FILES WERE FOUND. PLEASE MAKE SURE THAT\n"
@ -534,7 +534,7 @@ int main(int argc, char* argv[])
// Check if the media directory exists, and if not, log a warning. // Check if the media directory exists, and if not, log a warning.
if (!Utils::FileSystem::isDirectory(FileData::getMediaDirectory()) || if (!Utils::FileSystem::isDirectory(FileData::getMediaDirectory()) ||
Utils::FileSystem::isSymlink(FileData::getMediaDirectory())) { Utils::FileSystem::isSymlink(FileData::getMediaDirectory())) {
LOG(LogWarning) << "Warning - Games media directory does not exist " LOG(LogWarning) << "Games media directory does not exist "
"(or is not a directory or a symlink):"; "(or is not a directory or a symlink):";
LOG(LogWarning) << FileData::getMediaDirectory(); LOG(LogWarning) << FileData::getMediaDirectory();
} }

View file

@ -161,7 +161,7 @@ void thegamesdb_generate_json_scraper_requests(
first = false; first = false;
} }
else { else {
LOG(LogWarning) << "Warning - TheGamesDB scraper warning - " LOG(LogWarning) << "TheGamesDB scraper warning - "
"no support for platform " << getPlatformName(*platformIt); "no support for platform " << getPlatformName(*platformIt);
} }
} }
@ -380,7 +380,7 @@ void TheGamesDBJSONRequest::process(const std::unique_ptr<HttpReq>& req,
if (doc.HasParseError()) { if (doc.HasParseError()) {
std::string err = std::string err =
std::string("Error - TheGamesDBJSONRequest - Error parsing JSON. \n\t") + std::string("TheGamesDBJSONRequest - Error parsing JSON. \n\t") +
GetParseError_En(doc.GetParseError()); GetParseError_En(doc.GetParseError());
setError(err); setError(err);
LOG(LogError) << err; LOG(LogError) << err;
@ -399,8 +399,7 @@ void TheGamesDBJSONRequest::process(const std::unique_ptr<HttpReq>& req,
baseImageUrlLarge = base_url["large"].GetString(); baseImageUrlLarge = base_url["large"].GetString();
} }
else { else {
std::string warn = "Warning - TheGamesDBJSONRequest - No URL path for large images.\n"; LOG(LogWarning) << "TheGamesDBJSONRequest - No URL path for large images.\n";
LOG(LogWarning) << warn;
return; return;
} }
@ -408,7 +407,7 @@ void TheGamesDBJSONRequest::process(const std::unique_ptr<HttpReq>& req,
processMediaURLs(images, baseImageUrlLarge, results); processMediaURLs(images, baseImageUrlLarge, results);
} }
catch (std::runtime_error& e) { catch (std::runtime_error& e) {
LOG(LogError) << "Error - Error while processing media URLs: " << e.what(); LOG(LogError) << "Error while processing media URLs: " << e.what();
} }
// Find how many more requests we can make before the scraper // Find how many more requests we can make before the scraper
@ -427,8 +426,7 @@ void TheGamesDBJSONRequest::process(const std::unique_ptr<HttpReq>& req,
// These process steps are for the initial scraping response. // These process steps are for the initial scraping response.
if (!doc.HasMember("data") || !doc["data"].HasMember("games") || if (!doc.HasMember("data") || !doc["data"].HasMember("games") ||
!doc["data"]["games"].IsArray()) { !doc["data"]["games"].IsArray()) {
std::string warn = "Warning - TheGamesDBJSONRequest - Response had no game data.\n"; LOG(LogWarning) << "TheGamesDBJSONRequest - Response had no game data.\n";
LOG(LogWarning) << warn;
return; return;
} }
@ -441,7 +439,7 @@ void TheGamesDBJSONRequest::process(const std::unique_ptr<HttpReq>& req,
processGame(v, results); processGame(v, results);
} }
catch (std::runtime_error& e) { catch (std::runtime_error& e) {
LOG(LogError) << "Error - Error while processing game: " << e.what(); LOG(LogError) << "Error while processing game: " << e.what();
} }
} }
} }

View file

@ -125,14 +125,14 @@ bool TheGamesDBJSONRequestResources::saveResource(
{ {
if (req == nullptr) { if (req == nullptr) {
LOG(LogError) << "Error - HTTP request pointer was null.\n"; LOG(LogError) << "HTTP request pointer was null.\n";
return true; return true;
} }
if (req->status() == HttpReq::REQ_IN_PROGRESS) { if (req->status() == HttpReq::REQ_IN_PROGRESS) {
return false; // Not ready: wait some more. return false; // Not ready: wait some more.
} }
if (req->status() != HttpReq::REQ_SUCCESS) { if (req->status() != HttpReq::REQ_SUCCESS) {
LOG(LogError) << "Error - Resource request for " << file_name << LOG(LogError) << "Resource request for " << file_name <<
" failed:\n\t" << req->getErrorMsg(); " failed:\n\t" << req->getErrorMsg();
return true; // Request failed, resetting request.. return true; // Request failed, resetting request..
} }

View file

@ -31,8 +31,7 @@ std::unique_ptr<ScraperSearchHandle> startScraperSearch(const ScraperSearchParam
// Check if the scraper in the settings still exists as a registered scraping source. // Check if the scraper in the settings still exists as a registered scraping source.
if (scraper_request_funcs.find(name) == scraper_request_funcs.end()) if (scraper_request_funcs.find(name) == scraper_request_funcs.end())
LOG(LogWarning) << "Warning - Configured scraper (" << name << LOG(LogWarning) << "Configured scraper (" << name << ") unavailable, scraping aborted.";
") unavailable, scraping aborted.";
else else
scraper_request_funcs.at(name)(params, handle->mRequestQueue, handle->mResults); scraper_request_funcs.at(name)(params, handle->mRequestQueue, handle->mResults);
@ -47,8 +46,7 @@ std::unique_ptr<ScraperSearchHandle> startMediaURLsFetch(const std::string& game
ScraperSearchParams params; ScraperSearchParams params;
// Check if the scraper in the settings still exists as a registered scraping source. // Check if the scraper in the settings still exists as a registered scraping source.
if (scraper_request_funcs.find(name) == scraper_request_funcs.end()) { if (scraper_request_funcs.find(name) == scraper_request_funcs.end()) {
LOG(LogWarning) << "Warning - Configured scraper (" << name << LOG(LogWarning) << "Configured scraper (" << name << ") unavailable, scraping aborted.";
") unavailable, scraping aborted.";
} }
else { else {
// Specifically use the TheGamesDB function as this type of request // Specifically use the TheGamesDB function as this type of request
@ -145,7 +143,7 @@ void ScraperHttpRequest::update()
return; return;
// Everything else is some sort of error. // Everything else is some sort of error.
LOG(LogError) << "Error - ScraperHttpRequest network error (status: " << status<< ") - " LOG(LogError) << "ScraperHttpRequest network error (status: " << status<< ") - "
<< mReq->getErrorMsg(); << mReq->getErrorMsg();
setError(mReq->getErrorMsg()); setError(mReq->getErrorMsg());
} }
@ -407,7 +405,7 @@ bool resizeImage(const std::string& path, int maxWidth, int maxHeight)
if (format == FIF_UNKNOWN) if (format == FIF_UNKNOWN)
format = FreeImage_GetFIFFromFilename(path.c_str()); format = FreeImage_GetFIFFromFilename(path.c_str());
if (format == FIF_UNKNOWN) { if (format == FIF_UNKNOWN) {
LOG(LogError) << "Error - Could not detect filetype for image \"" << path << "\"!"; LOG(LogError) << "Could not detect filetype for image \"" << path << "\"!";
return false; return false;
} }
@ -416,7 +414,7 @@ bool resizeImage(const std::string& path, int maxWidth, int maxHeight)
image = FreeImage_Load(format, path.c_str()); image = FreeImage_Load(format, path.c_str());
} }
else { else {
LOG(LogError) << "Error - File format not supported for image \"" << path << "\"!"; LOG(LogError) << "File format not supported for image \"" << path << "\"!";
return false; return false;
} }
@ -437,7 +435,7 @@ bool resizeImage(const std::string& path, int maxWidth, int maxHeight)
FreeImage_Unload(image); FreeImage_Unload(image);
if (imageRescaled == nullptr) { if (imageRescaled == nullptr) {
LOG(LogError) << "Error - Could not resize image! (not enough memory? invalid bitdepth?)"; LOG(LogError) << "Could not resize image. (Not enough memory? Invalid bitdepth?)";
return false; return false;
} }
@ -445,7 +443,7 @@ bool resizeImage(const std::string& path, int maxWidth, int maxHeight)
FreeImage_Unload(imageRescaled); FreeImage_Unload(imageRescaled);
if (!saved) { if (!saved) {
LOG(LogError) << "Error - Failed to save resized image!"; LOG(LogError) << "Failed to save resized image.";
} }
return saved; return saved;

View file

@ -149,7 +149,7 @@ void screenscraper_generate_scraper_requests(const ScraperSearchParams& params,
p_ids.push_back(mapIt->second); p_ids.push_back(mapIt->second);
} }
else { else {
LOG(LogWarning) << "Warning - ScreenScraper: no support for platform " << LOG(LogWarning) << "ScreenScraper: no support for platform " <<
getPlatformName(*platformIt); getPlatformName(*platformIt);
// Add the scrape request without a platform/system ID. // Add the scrape request without a platform/system ID.
requests.push(std::unique_ptr<ScraperRequest> requests.push(std::unique_ptr<ScraperRequest>
@ -180,7 +180,7 @@ void ScreenScraperRequest::process(const std::unique_ptr<HttpReq>& req,
if (!parseResult) { if (!parseResult) {
std::stringstream ss; std::stringstream ss;
ss << "Error - ScreenScraperRequest - Error parsing XML: " << parseResult.description(); ss << "ScreenScraperRequest - Error parsing XML: " << parseResult.description();
std::string err = ss.str(); std::string err = ss.str();
setError(err); setError(err);

View file

@ -102,7 +102,7 @@ void AudioManager::init()
// Open the audio device and pause. // Open the audio device and pause.
if (SDL_OpenAudio(&sAudioFormat, nullptr) < 0) { if (SDL_OpenAudio(&sAudioFormat, nullptr) < 0) {
LOG(LogError) << "AudioManager Error - Unable to open SDL audio: " << LOG(LogError) << "AudioManager - Unable to open SDL audio: " <<
SDL_GetError() << std::endl; SDL_GetError() << std::endl;
} }
} }
@ -134,7 +134,7 @@ void AudioManager::unregisterSound(std::shared_ptr<Sound> & sound)
return; return;
} }
} }
LOG(LogError) << "AudioManager Error - tried to unregister a sound that wasn't registered!"; LOG(LogError) << "AudioManager - tried to unregister a sound that wasn't registered!";
} }
void AudioManager::play() void AudioManager::play()

View file

@ -61,11 +61,11 @@ std::vector<unsigned char> ImageIO::loadFromMemoryRGBA32(const unsigned char * d
} }
} }
else { else {
LOG(LogError) << "Error - Failed to load image from memory!"; LOG(LogError) << "Failed to load image from memory!";
} }
} }
else { else {
LOG(LogError) << "Error - Couldn't load image, file is missing or the file type is " << LOG(LogError) << "Couldn't load image, file is missing or the file type is " <<
// it's not existing or the file type " << // it's not existing or the file type " <<
(format == FIF_UNKNOWN ? "unknown" : "unsupported") << "!"; (format == FIF_UNKNOWN ? "unknown" : "unsupported") << "!";
} }

View file

@ -196,7 +196,7 @@ void InputConfig::loadFromXML(pugi::xml_node& node)
InputType typeEnum = stringToInputType(type); InputType typeEnum = stringToInputType(type);
if (typeEnum == TYPE_COUNT) { if (typeEnum == TYPE_COUNT) {
LOG(LogError) << "Error - InputConfig load error - input of type \"" << type << LOG(LogError) << "InputConfig load error - input of type \"" << type <<
"\" is invalid! Skipping input \"" << name << "\".\n"; "\" is invalid! Skipping input \"" << name << "\".\n";
continue; continue;
} }
@ -205,7 +205,7 @@ void InputConfig::loadFromXML(pugi::xml_node& node)
int value = input.attribute("value").as_int(); int value = input.attribute("value").as_int();
if (value == 0) { if (value == 0) {
LOG(LogWarning) << "Warning - InputConfig value is 0 for " << LOG(LogWarning) << "InputConfig value is 0 for " <<
type << " " << id << "!\n"; type << " " << id << "!\n";
} }

View file

@ -142,7 +142,7 @@ void InputManager::removeJoystickByJoystickID(SDL_JoystickID joyId)
mJoysticks.erase(joyIt); mJoysticks.erase(joyIt);
} }
else { else {
LOG(LogError) << "Error - Could not find joystick to close (instance ID: " << joyId << ")"; LOG(LogError) << "Could not find joystick to close (instance ID: " << joyId << ")";
} }
} }
@ -472,7 +472,7 @@ void InputManager::doOnFinish()
#endif #endif
if (!result) { if (!result) {
LOG(LogError) << "Error - Couldn't parse input config: " << result.description(); LOG(LogError) << "Couldn't parse input config: " << result.description();
} }
else { else {
pugi::xml_node root = doc.child("inputList"); pugi::xml_node root = doc.child("inputList");
@ -546,7 +546,7 @@ std::string InputManager::getDeviceGUIDString(int deviceId)
auto it = mJoysticks.find(deviceId); auto it = mJoysticks.find(deviceId);
if (it == mJoysticks.cend()) { if (it == mJoysticks.cend()) {
LOG(LogError) << "Error - getDeviceGUIDString - deviceId " << deviceId << " not found!"; LOG(LogError) << "getDeviceGUIDString - deviceId " << deviceId << " not found!";
return "something went horribly wrong"; return "something went horribly wrong";
} }

View file

@ -52,7 +52,7 @@ void Log::open()
std::ostringstream& Log::get(LogLevel level) std::ostringstream& Log::get(LogLevel level)
{ {
time_t t = time(nullptr); time_t t = time(nullptr);
os << std::put_time(localtime(&t), "%b %d %T ") << "lvl" << level << ": \t"; os << std::put_time(localtime(&t), "%b %d %T ") << logLevelMap[level] << ":\t";
messageLevel = level; messageLevel = level;
return os; return os;

View file

@ -9,6 +9,7 @@
#define ES_CORE_LOG_H #define ES_CORE_LOG_H
#include <sstream> #include <sstream>
#include <map>
#define LOG(level) \ #define LOG(level) \
if (level > Log::getReportingLevel()); \ if (level > Log::getReportingLevel()); \
@ -41,6 +42,13 @@ protected:
std::ostringstream os; std::ostringstream os;
private: private:
std::map<LogLevel, std::string> logLevelMap {
{ LogError, "Error" },
{ LogWarning, "Warn" },
{ LogInfo, "Info" },
{ LogDebug, "Debug" }
};
static LogLevel reportingLevel; static LogLevel reportingLevel;
LogLevel messageLevel; LogLevel messageLevel;
}; };

View file

@ -78,7 +78,7 @@ int launchEmulatorUnix(const std::string& cmd_utf8)
int returnValue; int returnValue;
if (!(commandPipe = (FILE*)popen(command.c_str(), "r"))) { if (!(commandPipe = (FILE*)popen(command.c_str(), "r"))) {
LOG(LogError) << "Error - couldn't open pipe to command."; LOG(LogError) << "Couldn't open pipe to command.";
return -1; return -1;
} }
@ -97,7 +97,7 @@ int launchEmulatorUnix(const std::string& cmd_utf8)
} }
if (returnValue) { if (returnValue) {
LOG(LogError) << "Error - launchEmulatorUnix - return value " << LOG(LogError) << "launchEmulatorUnix - return value " <<
std::to_string(returnValue) + ":"; std::to_string(returnValue) + ":";
if (commandOutput.size()) if (commandOutput.size())
LOG(LogError) << commandOutput; LOG(LogError) << commandOutput;
@ -170,7 +170,7 @@ int launchEmulatorWindows(const std::wstring& cmd_utf16)
} }
} }
LOG(LogError) << "Error - launchEmulatorWindows - system error code " << LOG(LogError) << "launchEmulatorWindows - system error code " <<
errorCode << ": " << errorMessage; errorCode << ": " << errorMessage;
} }
@ -230,7 +230,7 @@ int quitES(QuitMode mode)
void emergencyShutdown() void emergencyShutdown()
{ {
LOG(LogError) << "Critical Error - Performing emergency shutdown..."; LOG(LogError) << "Critical - Performing emergency shutdown...";
MameNames::deinit(); MameNames::deinit();
AudioManager::getInstance()->deinit(); AudioManager::getInstance()->deinit();

View file

@ -306,7 +306,7 @@ void Settings::loadFile()
pugi::xml_parse_result result = doc.load_file(path.c_str()); pugi::xml_parse_result result = doc.load_file(path.c_str());
#endif #endif
if (!result) { if (!result) {
LOG(LogError) << "Error - Could not parse Settings file!\n " << result.description(); LOG(LogError) << "Could not parse Settings file.\n " << result.description();
return; return;
} }
@ -326,7 +326,7 @@ void Settings::loadFile()
type Settings::getMethodName(const std::string& name) \ type Settings::getMethodName(const std::string& name) \
{ \ { \
if (mapName.find(name) == mapName.cend()) { \ if (mapName.find(name) == mapName.cend()) { \
LOG(LogError) << "Error - Tried to use unset setting " << name << "!"; \ LOG(LogError) << "Tried to use unset setting " << name << "!"; \
} \ } \
return mapName[name]; \ return mapName[name]; \
} \ } \

View file

@ -117,7 +117,7 @@ void Sound::init()
Uint8 * data = nullptr; Uint8 * data = nullptr;
Uint32 dlen = 0; Uint32 dlen = 0;
if (SDL_LoadWAV(mPath.c_str(), &wave, &data, &dlen) == nullptr) { if (SDL_LoadWAV(mPath.c_str(), &wave, &data, &dlen) == nullptr) {
LOG(LogError) << "Error - Failed to load theme navigation sound file:"; LOG(LogError) << "Failed to load theme navigation sound file:";
LOG(LogError) << SDL_GetError(); LOG(LogError) << SDL_GetError();
return; return;
} }

View file

@ -67,7 +67,7 @@ std::string ResourceManager::getResourcePath(const std::string& path) const
// For missing resources, log an error and terminate the application. This should // For missing resources, log an error and terminate the application. This should
// indicate that we have a broken EmulationStation installation. // indicate that we have a broken EmulationStation installation.
else { else {
LOG(LogError) << "Error - Program resource missing: " << path; LOG(LogError) << "Program resource missing: " << path;
LOG(LogError) << "Tried to find the resource in the following locations:"; LOG(LogError) << "Tried to find the resource in the following locations:";
LOG(LogError) << testHome; LOG(LogError) << testHome;
#ifdef __unix__ #ifdef __unix__

View file

@ -544,19 +544,19 @@ namespace Utils
const std::string& _destination_path, bool _overwrite) const std::string& _destination_path, bool _overwrite)
{ {
if (!exists(_source_path)) { if (!exists(_source_path)) {
LOG(LogError) << "Error - Can't copy file, source file does not exist:"; LOG(LogError) << "Can't copy file, source file does not exist:";
LOG(LogError) << _source_path; LOG(LogError) << _source_path;
return true; return true;
} }
if (isDirectory(_destination_path)) { if (isDirectory(_destination_path)) {
LOG(LogError) << "Error - Destination file is actually a directory:"; LOG(LogError) << "Destination file is actually a directory:";
LOG(LogError) << _destination_path; LOG(LogError) << _destination_path;
return true; return true;
} }
if (!_overwrite && exists(_destination_path)) { if (!_overwrite && exists(_destination_path)) {
LOG(LogError) << "Error - Destination file exists and the overwrite flag " LOG(LogError) << "Destination file exists and the overwrite flag "
"has not been set."; "has not been set.";
return true; return true;
} }
@ -569,7 +569,7 @@ namespace Utils
#endif #endif
if (sourceFile.fail()) { if (sourceFile.fail()) {
LOG(LogError) << "Error - Couldn't read from source file (" << _source_path << LOG(LogError) << "Couldn't read from source file (" << _source_path <<
"), permission problems?"; "), permission problems?";
sourceFile.close(); sourceFile.close();
return true; return true;
@ -583,7 +583,7 @@ namespace Utils
#endif #endif
if (targetFile.fail()) { if (targetFile.fail()) {
LOG(LogError) << "Error - Couldn't write to target file (" << _destination_path << LOG(LogError) << "Couldn't write to target file (" << _destination_path <<
"), permission problems?"; "), permission problems?";
targetFile.close(); targetFile.close();
return true; return true;
@ -608,13 +608,13 @@ namespace Utils
} }
if (isDirectory(_destination_path)) { if (isDirectory(_destination_path)) {
LOG(LogError) << "Error - Destination file is actually a directory:"; LOG(LogError) << "Destination file is actually a directory:";
LOG(LogError) << _destination_path; LOG(LogError) << _destination_path;
return true; return true;
} }
if (!_overwrite && exists(_destination_path)) { if (!_overwrite && exists(_destination_path)) {
LOG(LogError) << "Error - Destination file exists and the overwrite flag " LOG(LogError) << "Destination file exists and the overwrite flag "
"has not been set."; "has not been set.";
return true; return true;
} }
@ -640,7 +640,7 @@ namespace Utils
// Try to remove file. // Try to remove file.
#ifdef _WIN64 #ifdef _WIN64
if (_wunlink(Utils::String::stringToWideString(path).c_str()) != 0) { if (_wunlink(Utils::String::stringToWideString(path).c_str()) != 0) {
LOG(LogError) << "Error - Couldn't delete file, permission problems?"; LOG(LogError) << "Couldn't delete file, permission problems?";
LOG(LogError) << path; LOG(LogError) << path;
return true; return true;
} }
@ -649,7 +649,7 @@ namespace Utils
} }
#else #else
if (unlink(path.c_str()) != 0) { if (unlink(path.c_str()) != 0) {
LOG(LogError) << "Error - Couldn't delete file, permission problems?"; LOG(LogError) << "Couldn't delete file, permission problems?";
LOG(LogError) << path; LOG(LogError) << path;
return true; return true;
} }