Fixed some Log:: messages that used incorrect syntax and did not print

some variables. Made all log:: messages use the same components 'addons'.
This commit is contained in:
hiker 2014-08-22 16:34:18 +10:00
parent 3ef30dfd48
commit 52a7d071dd

View File

@ -114,13 +114,13 @@ void AddonsManager::init(const XMLNode *xml,
if (download)
{
Log::info("NetworkHttp", "Downloading updated addons.xml");
Log::info("addons", "Downloading updated addons.xml.");
Online::HTTPRequest *download_request = new Online::HTTPRequest("addons.xml");
download_request->setURL(addon_list_url);
download_request->executeNow();
if(download_request->hadDownloadError())
{
Log::error("addons", "Error on download addons.xml: %s\n",
Log::error("addons", "Error on download addons.xml: %s.",
download_request->getDownloadErrorMessage());
delete download_request;
return;
@ -129,12 +129,12 @@ void AddonsManager::init(const XMLNode *xml,
UserConfigParams::m_addons_last_updated=StkTime::getTimeSinceEpoch();
}
else
Log::info("NetworkHttp", "Using cached addons.xml");
Log::info("addons", "Using cached addons.xml.");
const XMLNode *xml_addons = new XMLNode(filename);
addons_manager->initAddons(xml_addons); // will free xml_addons
if(UserConfigParams::logAddons())
Log::info("addons", "Addons manager list downloaded");
Log::info("addons", "Addons manager list downloaded.");
} // init
// ----------------------------------------------------------------------------
@ -195,7 +195,7 @@ void AddonsManager::initAddons(const XMLNode *xml)
if(file_manager->fileExists(full_path))
{
if(UserConfigParams::logAddons())
Log::warn("[AddonsManager] Removing cached icon '%s'.\n",
Log::warn("addons", "Removing cached icon '%s'.",
addon.getIconBasename().c_str());
file_manager->removeFile(full_path);
}
@ -226,9 +226,9 @@ void AddonsManager::initAddons(const XMLNode *xml)
}
else
{
Log::error("[AddonsManager]", "Found invalid node '%s' while downloading addons.",
Log::error("addons", "Found invalid node '%s' while downloading addons.",
node->getName().c_str());
Log::error("[AddonsManager]", "Ignored.");
Log::error("addons", "Ignored.");
}
} // for i<xml->getNumNodes
delete xml;
@ -254,7 +254,7 @@ void AddonsManager::initAddons(const XMLNode *xml)
// it from the list.
if(UserConfigParams::logAddons())
Log::warn(
"[AddonsManager] Removing '%s' which is not on the server anymore.\n",
"addons", "Removing '%s' which is not on the server anymore.",
m_addons_list.getData()[i].getId().c_str() );
const std::string &icon = m_addons_list.getData()[i].getIconBasename();
std::string icon_file =file_manager->getAddonsFile("icons/"+icon);
@ -311,7 +311,7 @@ void AddonsManager::checkInstalledAddons()
if(n<0) continue;
if(!m_addons_list.getData()[n].isInstalled())
{
Log::info("[AddonsManager] Marking '%s' as being installed.",
Log::info("addons", "Marking '%s' as being installed.",
kp->getIdent().c_str());
m_addons_list.getData()[n].setInstalled(true);
something_was_changed = true;
@ -330,7 +330,7 @@ void AddonsManager::checkInstalledAddons()
if(n<0) continue;
if(!m_addons_list.getData()[n].isInstalled())
{
Log::info("[AddonsManager] Marking '%s' as being installed.",
Log::info("addons", "Marking '%s' as being installed.",
track->getIdent().c_str());
m_addons_list.getData()[n].setInstalled(true);
something_was_changed = true;
@ -361,7 +361,7 @@ void AddonsManager::downloadIcons()
if(icon=="")
{
if(UserConfigParams::logAddons())
Log::error("[AddonsManager]", "No icon or image specified for '%s'.",
Log::error("addons", "No icon or image specified for '%s'.",
addon.getId().c_str());
continue;
}
@ -400,7 +400,7 @@ void AddonsManager::loadInstalledAddons()
/* checking for installed addons */
if(UserConfigParams::logAddons())
{
Log::info("[AddonsManager]", "Loading an xml file for installed addons: %s",
Log::info("addons", "Loading an xml file for installed addons: %s.",
m_file_installed.c_str());
}
const XMLNode *xml = file_manager->createXMLTree(m_file_installed);
@ -478,15 +478,15 @@ bool AddonsManager::install(const Addon &addon)
if (!success)
{
// TODO: show a message in the interface
Log::error("[AddonsManager]", "Failed to unzip '%s' to '%s'",
Log::error("addons", "Failed to unzip '%s' to '%s'.",
from.c_str(), to.c_str());
Log::error("[AddonsManager]", "Zip file will not be removed.");
Log::error("addons", "Zip file will not be removed.");
return false;
}
if(!file_manager->removeFile(from))
{
Log::error("[AddonsManager]", "Problems removing temporary file '%s'",
Log::error("addons", "Problems removing temporary file '%s'.",
from.c_str());
}
@ -520,7 +520,7 @@ bool AddonsManager::install(const Addon &addon)
}
catch (std::exception& e)
{
Log::error("[AddonsManager]", "ERROR: Cannot load track <%s> : %s",
Log::error("addons", "Cannot load track '%s' : %s.",
addon.getDataDir().c_str(), e.what());
}
}
@ -535,8 +535,8 @@ bool AddonsManager::install(const Addon &addon)
*/
bool AddonsManager::uninstall(const Addon &addon)
{
Log::info("[AddonsManager]", "Uninstalling <%s>",
core::stringc(addon.getName()).c_str());
Log::info("addons", "Uninstalling '%s'.",
core::stringc(addon.getName()).c_str());
// addon is a const reference, and to avoid removing the const, we
// find the proper index again to modify the installed state