From: HOSEON LEE Date: Mon, 16 Sep 2013 03:05:56 +0000 (+0000) Subject: Revert "Reformatting wrt-installer debug logs" X-Git-Tag: 2.2.1_release~10^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e4c62977370b6f4c44a19705a1ea025bd6e2d973;p=framework%2Fweb%2Fwrt-installer.git Revert "Reformatting wrt-installer debug logs" This reverts commit 7facd01b36d15dceca3819baa339163d2a24f679. Change-Id: I74b9c82da92d047d669fc1c1afb474ca40e5bfb8 --- diff --git a/src/commons/installer_log.h b/src/commons/installer_log.h index 7016c34..fab5b44 100644 --- a/src/commons/installer_log.h +++ b/src/commons/installer_log.h @@ -23,6 +23,7 @@ #ifndef INSTALLER_LOG_H #define INSTALLER_LOG_H +#include #include #include diff --git a/src/configuration_parser/parser_runner.cpp b/src/configuration_parser/parser_runner.cpp index 0a0f33c..cdc7caa 100644 --- a/src/configuration_parser/parser_runner.cpp +++ b/src/configuration_parser/parser_runner.cpp @@ -29,8 +29,7 @@ #include #include #include - -#include +#include class ParserRunner::Impl { @@ -41,7 +40,7 @@ class ParserRunner::Impl va_start(args, msg); vsnprintf(buffer, 300, msg, args); va_end(args); - _E("%s", buffer); + LogError(buffer); } static void logWarningLibxml2(void *, const char *msg, ...) @@ -51,7 +50,7 @@ class ParserRunner::Impl va_start(args, msg); vsnprintf(buffer, 300, msg, args); va_end(args); - _W("%s", buffer); + LogWarning(buffer); } public: @@ -63,29 +62,29 @@ class ParserRunner::Impl xmlSchemaPtr xschema; ctx = xmlSchemaNewParserCtxt(schema.c_str()); if (ctx == NULL) { - _E("xmlSchemaNewParserCtxt() Failed"); + LogError("xmlSchemaNewParserCtxt() Failed"); return false; } xschema = xmlSchemaParse(ctx); if (xschema == NULL) { - _E("xmlSchemaParse() Failed"); + LogError("xmlSchemaParse() Failed"); return false; } vctx = xmlSchemaNewValidCtxt(xschema); if (vctx == NULL) { - _E("xmlSchemaNewValidCtxt() Failed"); + LogError("xmlSchemaNewValidCtxt() Failed"); return false; } xmlSchemaSetValidErrors(vctx, (xmlSchemaValidityErrorFunc)&logErrorLibxml2, (xmlSchemaValidityWarningFunc) &logWarningLibxml2, NULL); ret = xmlSchemaValidateFile(vctx, filename.c_str(), 0); if (ret == -1) { - _E("xmlSchemaValidateFile() failed"); + LogError("xmlSchemaValidateFile() failed"); return false; } else if (ret == 0) { - _E("Config is Valid"); + LogError("Config is Valid"); return true; } else { - _E("Config Validation Failed with error code %d", ret); + LogError("Config Validation Failed with error code " << ret); return false; } return true; @@ -150,18 +149,19 @@ class ParserRunner::Impl break; } default: - _W("Ignoring Node of Type: %d", xmlTextReaderNodeType(m_reader)); + LogWarning("Ignoring Node of Type: " << + xmlTextReaderNodeType(m_reader)); break; } if (m_parsingError) { - _E("Parsing error occured: %s", m_errorMsg.c_str()); + LogError("Parsing error occured: " << m_errorMsg); ThrowMsg(ElementParser::Exception::ParseError, m_errorMsg); } } if (m_parsingError) { - _E("Parsing error occured: %s", m_errorMsg.c_str()); + LogError("Parsing error occured: " << m_errorMsg); ThrowMsg(ElementParser::Exception::ParseError, m_errorMsg); } @@ -172,7 +172,7 @@ class ParserRunner::Impl Catch(ElementParser::Exception::Base) { CleanupParserRunner(); - _E("%s", _rethrown_exception.DumpToString().c_str()); + LogError(_rethrown_exception.DumpToString()); ReThrow(ElementParser::Exception::ParseError); } CleanupParserRunner(); @@ -267,7 +267,9 @@ class ParserRunner::Impl element.lang = GetLanguageTag(); element.ns = GetNamespace(); - _D("value: %ls, lang: %ls, ns: %ls)", element.value.c_str(), element.lang.c_str(), element.ns.c_str()); + LogDebug("value: " << element.value << + ", lang: " << element.lang << + ", ns: " << element.ns << ")"); parser->Accept(element); ParseNodeElementAttributes(parser); @@ -276,6 +278,7 @@ class ParserRunner::Impl void ParseNodeElementAttributes(const ElementParserPtr& parser) { Assert(m_reader); + int count = xmlTextReaderAttributeCount(m_reader); for (int i = 0; i < count; ++i) { xmlTextReaderMoveToAttributeNo(m_reader, i); @@ -286,8 +289,11 @@ class ParserRunner::Impl attribute.name = GetNameWithoutNamespace(); attribute.value = GetValue(); attribute.lang = GetLanguageTag(); - _D("Attribute name: %ls, value: %ls, prefix: %ls, namespace: %ls, lang: %ls", - attribute.name.c_str(), attribute.value.c_str(), attribute.prefix.c_str(), attribute.ns.c_str(), attribute.lang.c_str()); + LogDebug("Attribute name: " << attribute.name << + ", value: " << attribute.value << + ", prefix: " << attribute.prefix << + ", namespace: " << attribute.ns << + ", lang: " << attribute.lang); parser->Accept(attribute); } } @@ -401,7 +407,7 @@ class ParserRunner::Impl void ErrorHandler(const DPL::String& msg) { - _E("LibXML: %s", msg.c_str()); + LogError("LibXML: " << msg); m_parsingError = true; m_errorMsg = m_errorMsg + DPL::FromASCIIString("\n"); m_errorMsg = m_errorMsg + msg; @@ -409,7 +415,7 @@ class ParserRunner::Impl void StructuredErrorHandler(xmlErrorPtr error) { - _E("LibXML: %s", error->message); + LogError("LibXML: " << error->message); m_parsingError = true; m_errorMsg = m_errorMsg + DPL::FromASCIIString("\n"); m_errorMsg = m_errorMsg + DPL::FromUTF8String(error->message); diff --git a/src/configuration_parser/widget_parser.cpp b/src/configuration_parser/widget_parser.cpp index 7e435de..7c0b624 100644 --- a/src/configuration_parser/widget_parser.cpp +++ b/src/configuration_parser/widget_parser.cpp @@ -35,6 +35,7 @@ #include "wrt-commons/i18n-dao-ro/i18n_dao_read_only.h" #include +#include #include #include #include @@ -48,8 +49,6 @@ #include #include -#include - using namespace WrtDB; namespace Unicode { @@ -71,7 +70,7 @@ Direction ParseDirAttribute(const XmlAttribute& attribute) } else if (L"rlo" == attribute.value) { return RLO; } else { - _W("dir attribute has wrong value: %ls ", attribute.value.c_str()); + LogWarning("dir attribute has wrong value:" << attribute.value); return EMPTY; } } @@ -284,7 +283,7 @@ class AccessParser : public ElementParser AcceptWac(attribute); break; default: - _E("Error in Access tag - unknown standard."); + LogError("Error in Access tag - unknown standard."); break; } } @@ -295,7 +294,10 @@ class AccessParser : public ElementParser iri.set(m_strIRIOrigin, false); if (!iri.isAccessDefinition()) { - _W("Access list element: %ls is not acceptable by WARP standard and will be ignored!", m_strIRIOrigin.c_str()); + LogWarning("Access list element: " << + m_strIRIOrigin << + " is not acceptable by WARP" << + "standard and will be ignored!"); return; } @@ -317,7 +319,7 @@ class AccessParser : public ElementParser VerifyWac(); break; default: - _E("Error in Access tag - unknown standard."); + LogError("Error in Access tag - unknown standard."); break; } } @@ -600,7 +602,7 @@ class IconParser : public ElementParser virtual void Verify() { if (m_src.IsNull()) { - _W("src attribute of icon element is mandatory - ignoring"); + LogWarning("src attribute of icon element is mandatory - ignoring"); return; } @@ -618,7 +620,7 @@ class IconParser : public ElementParser } Catch(BadSrcError) { - _W("src attribute is invalid: %ls", (*m_src).c_str()); + LogWarning("src attribute is invalid: " << m_src); } } @@ -793,7 +795,7 @@ class PreferenceParser : public ElementParser virtual void Verify() { if (m_name.IsNull()) { - _W("preference element must have name attribute"); + LogWarning("preference element must have name attribute"); return; } NormalizeString(m_name); @@ -983,7 +985,7 @@ class AppControlParser : public ElementParser if (!m_value.IsNull() && *m_value == ignoreUri) { - _D("exception : '%ls' scheme will be ignored.", (*m_value).c_str()); + LogDebug("exception : '" << *m_value << "' scheme will be ignored."); m_value = DPL::OptionalString::Null; } @@ -997,7 +999,8 @@ class AppControlParser : public ElementParser { m_data.m_uriList.insert(*m_value); } else { - _D("Ignoring uri with name %ls", (*m_value).c_str()); + LogDebug("Ignoring uri with name" << + DPL::ToUTF8String(*m_value)); } } @@ -1052,7 +1055,8 @@ class AppControlParser : public ElementParser { m_data.m_mimeList.insert(*m_value); } else { - _D("Ignoring mime with name %ls", (*m_value).c_str()); + LogDebug("Ignoring mime with name" << + DPL::ToUTF8String(*m_value)); } } @@ -1109,7 +1113,8 @@ class AppControlParser : public ElementParser m_data.m_disposition = ConfigParserData::AppControlInfo::Disposition::INLINE; } else { - _D("Ignoring dispostion value %ls", (*m_value).c_str()); + LogDebug("Ignoring dispostion value " << + DPL::ToUTF8String(*m_value)); } } @@ -1150,7 +1155,7 @@ class AppControlParser : public ElementParser virtual void Accept(const Element& element) { - _W("namespace for app service = %ls", element.ns.c_str()); + LogWarning("namespace for app service = " << element.ns); if (element.ns == ConfigurationNamespace::W3CWidgetNamespaceName) { ThrowMsg(Exception::ParseError, "Wrong xml namespace for widget element"); @@ -1385,7 +1390,7 @@ class SplashParser : public ElementParser { if (m_src.IsNull()) { - _W("src attribute of splash element is mandatory - ignoring"); + LogWarning("src attribute of splash element is mandatory - ignoring"); return; } @@ -1431,7 +1436,7 @@ class BackgroundParser : public ElementParser virtual void Verify() { if (m_src.IsNull()) { - _W( + LogWarning( "src attribute of background element is mandatory - ignoring"); return; } @@ -1467,7 +1472,7 @@ class PrivilegeParser : public ElementParser { m_properNamespace = true; } - _D("element"); + LogDebug("element"); } virtual void Accept(const XmlAttribute& attribute) @@ -1491,7 +1496,8 @@ class PrivilegeParser : public ElementParser { m_data.featuresList.insert(m_feature); } else { - _D("Ignoring feature with name %ls", DPL::ToUTF8String(m_feature.name).c_str()); + LogDebug("Ignoring feature with name" << + DPL::ToUTF8String(m_feature.name)); } } } @@ -1506,7 +1512,8 @@ class PrivilegeParser : public ElementParser { m_data.privilegeList.insert(m_privilege); } else { - _D("Ignoring privilege with name %ls", DPL::ToUTF8String(m_privilege.name).c_str()); + LogDebug("Ignoring privilege with name" << + DPL::ToUTF8String(m_privilege.name)); } } } @@ -1554,7 +1561,7 @@ class CategoryParser : public ElementParser virtual void Verify() { if (m_name.IsNull()) { - _W( + LogWarning( "name attribute of category element is mandatory - ignoring"); return; } @@ -1613,7 +1620,7 @@ class AppWidgetParser : public ElementParser { std::pair boxLabel; if (m_label.empty()) { - _W("box-label element is empty"); + LogWarning("box-label element is empty"); boxLabel.first = DPL::FromUTF8String(""); boxLabel.second = DPL::FromUTF8String(""); m_data.m_label.push_back(boxLabel); @@ -1822,10 +1829,10 @@ class AppWidgetParser : public ElementParser if (*height < 1) { m_height = L"1"; - _D("height attribute of pd element shouldn't be less than 1. Changed to 1 from %ld", *height); + LogDebug("height attribute of pd element shouldn't be less than 1. Changed to 1 from " << *height); } else if (*height > 380){ m_height = L"380"; - _D("height attribute of pd element shouldn't be greater than 380. Changed to 380 from %ld", *height); + LogDebug("height attribute of pd element shouldn't be greater than 380. Changed to 380 from " << *height); } m_data.m_pdSrc = m_src; @@ -2058,19 +2065,19 @@ class AppWidgetParser : public ElementParser //set standard locale to fix decimal point mark - '.' std::string currentLocale = setlocale(LC_NUMERIC, NULL); if (NULL == setlocale(LC_NUMERIC, "C")) - _W("Failed to change locale to \"C\""); + LogWarning("Failed to change locale to \"C\""); double updatePeriod = strtod(tempStr.c_str(), &endptr); //go back to previous locale if (NULL == setlocale(LC_NUMERIC, currentLocale.c_str())) - _W("Failed to set previous locale"); + LogWarning("Failed to set previous locale"); if ((errno == ERANGE && (updatePeriod == -HUGE_VAL || updatePeriod == HUGE_VAL)) || *endptr != '\0') { ThrowMsg(Exception::ParseError, "update-period attribute of app-widget element should be a number - ignoring. current value: " << m_updatePeriod); } else if (updatePeriod < 1800.0) { - _D("update-period attribute of app-widget element shouldn't be less than 1800.0 - changed to 1800 from value: %s", m_updatePeriod.c_str()); + LogDebug("update-period attribute of app-widget element shouldn't be less than 1800.0 - changed to 1800 from value: " << m_updatePeriod); m_updatePeriod = L"1800.0"; } } @@ -2187,7 +2194,7 @@ class AllowNavigationParser : public ElementParser m_data.allowNavigationEncountered = true; if (m_origin.IsNull()) { - _W("data is empty"); + LogWarning("data is empty"); return; } @@ -2207,7 +2214,7 @@ class AllowNavigationParser : public ElementParser // input origin should has schem and host // in case of file scheme path is filled // "http://" - _W("input origin isn't verified"); + LogWarning("input origin isn't verified"); continue; } DPL::String scheme = L"*"; @@ -2621,7 +2628,7 @@ class MetadataParser : public ElementParser virtual void Verify() { if (m_key.IsNull()) { - _W("metadata element must have key attribute"); + LogWarning("metadata element must have key attribute"); return; } NormalizeString(m_key); @@ -2629,7 +2636,7 @@ class MetadataParser : public ElementParser ConfigParserData::Metadata metaData(m_key, m_value); FOREACH(it, m_data.metadataList) { if (!DPL::StringCompare(*it->key, *m_key)) { - _E("Key isn't unique"); + LogError("Key isn't unique"); return; } } @@ -2843,13 +2850,13 @@ void WidgetParser::Accept(const XmlAttribute& attribute) m_data.widget_id = attribute.value; NormalizeString(m_data.widget_id); } else { - _W("Widget id validation failed: %ls", attribute.value.c_str()); + LogWarning("Widget id validation failed: " << attribute.value); } } else if (attribute.name == L"version") { m_version = attribute.value; NormalizeString(m_version); } else if (attribute.name == L"min-version") { - _D("min-version attribute was found. Value: %ls", attribute.value.c_str()); + LogDebug("min-version attribute was found. Value: " << attribute.value); m_minVersion = attribute.value; NormalizeString(m_minVersion); m_data.minVersionRequired = m_minVersion; @@ -2909,21 +2916,23 @@ void WidgetParser::Accept(const XmlAttribute& attribute) NormalizeString(m_defaultlocale); if( I18n::DB::I18nDAOReadOnly::IsValidSubTag (attribute.value, RECORD_TYPE_LANGUAGE)) { - _D("Default Locale Found %ls", (*m_defaultlocale).c_str()); + LogDebug("Default Locale Found " << m_defaultlocale); } else { - _W("Default Locate Is Invalid"); + LogWarning("Default Locate Is Invalid"); } } else { - _W("Ignoring subsequent default locale"); + LogWarning("Ignoring subsequent default locale"); } //Any other value consider as a namespace definition } else if (attribute.name == L"xmlns" || attribute.prefix == L"xmlns") { - _D("Namespace domain: %ls", attribute.name.c_str()); - _D("Namespace value: %ls", attribute.value.c_str()); + LogDebug("Namespace domain: " << attribute.name); + LogDebug("Namespace value: " << attribute.value); m_nameSpaces[attribute.name] = attribute.value; } else { - _E("Unknown attirbute: namespace=%ls, name=%ls, value=%ls", attribute.ns.c_str(), attribute.name.c_str(), attribute.value.c_str()); + LogError("Unknown attirbute: namespace=" << attribute.ns << + ", name=" << attribute.name << + ", value=" << attribute.value); } } diff --git a/src/jobs/plugin_install/job_plugin_install.cpp b/src/jobs/plugin_install/job_plugin_install.cpp index fe01495..7835449 100644 --- a/src/jobs/plugin_install/job_plugin_install.cpp +++ b/src/jobs/plugin_install/job_plugin_install.cpp @@ -23,7 +23,6 @@ #include #include "plugin_objects.h" #include -#include namespace Jobs { namespace PluginInstall { @@ -50,7 +49,7 @@ JobPluginInstall::JobPluginInstall(PluginPath const &pluginPath, void JobPluginInstall::SendProgress() { if (GetProgressFlag() && GetInstallerStruct().progressCallback != NULL) { - _D("Call Plugin install progressCallback"); + LogDebug("Call Plugin install progressCallback"); GetInstallerStruct().progressCallback(GetInstallerStruct().userParam, GetProgressPercent(), GetProgressDescription()); @@ -64,24 +63,25 @@ void JobPluginInstall::SendFinishedSuccess() if (handle != Jobs::PluginInstall::JobPluginInstall::INVALID_HANDLE && isReadyToInstall()) { - _D("Call Plugin install success finishedCallback"); + LogDebug("Call Plugin install success finishedCallback"); GetInstallerStruct().finishedCallback(GetInstallerStruct().userParam, Jobs::Exceptions::Success); } else { - _D("Call Plugin install waiting finishedCallback"); + LogDebug("Call Plugin install waiting finishedCallback"); GetInstallerStruct().finishedCallback(GetInstallerStruct().userParam, Jobs::Exceptions::ErrorPluginInstallationFailed); - _D("Installation: %s NOT possible", getFilePath().c_str()); + LogDebug("Installation: " << getFilePath() << + " NOT possible"); } } void JobPluginInstall::SendFinishedFailure() { - _E("Error in plugin installation step: %s", m_exceptionCaught); - _E("Message: %s", m_exceptionMessage.c_str()); + LogError("Error in plugin installation step: " << m_exceptionCaught); + LogError("Message: " << m_exceptionMessage); - _D("Call Plugin install failure finishedCallback"); + LogDebug("Call Plugin install failure finishedCallback"); GetInstallerStruct().finishedCallback(GetInstallerStruct().userParam, m_exceptionCaught); } diff --git a/src/jobs/plugin_install/plugin_install_task.cpp b/src/jobs/plugin_install/plugin_install_task.cpp index 2d87e95..55f4105 100644 --- a/src/jobs/plugin_install/plugin_install_task.cpp +++ b/src/jobs/plugin_install/plugin_install_task.cpp @@ -27,6 +27,7 @@ #include //WRT INCLUDES +#include #include #include #include "plugin_install_task.h" @@ -41,7 +42,6 @@ #include "plugin_objects.h" #include #include -#include using namespace WrtDB; @@ -52,7 +52,7 @@ using namespace WrtDB; #define DISABLE_IF_PLUGIN_WITHOUT_LIB() \ if (m_pluginInfo.m_libraryName.empty()) \ { \ - _W("Plugin without library."); \ + LogWarning("Plugin without library."); \ return; \ } @@ -82,7 +82,7 @@ PluginInstallTask::~PluginInstallTask() void PluginInstallTask::stepCheckPluginPath() { - _D("Plugin installation: step CheckPluginPath"); + LogDebug("Plugin installation: step CheckPluginPath"); if(!m_context->pluginFilePath.Exists()){ ThrowMsg(Exceptions::PluginPathFailed, @@ -94,14 +94,14 @@ void PluginInstallTask::stepCheckPluginPath() void PluginInstallTask::stepParseConfigFile() { - _D("Plugin installation: step parse config file"); + LogDebug("Plugin installation: step parse config file"); if(!m_context->pluginFilePath.getMetaFile().Exists()){ m_dataFromConfigXML = false; return; } - _D("Plugin Config file::%s", m_context->pluginFilePath.getMetaFile().Fullpath().c_str()); + LogInfo("Plugin Config file::" << m_context->pluginFilePath.getMetaFile()); Try { @@ -111,9 +111,9 @@ void PluginInstallTask::stepParseConfigFile() FOREACH(it, m_pluginInfo.m_featureContainer) { - _D("Parsed feature : %ls", it->m_name.c_str()); + LogDebug("Parsed feature : " << it->m_name); FOREACH(devCap, it->m_deviceCapabilities) { - _D(" | DevCap : %ls", (*devCap).c_str()); + LogDebug(" | DevCap : " << *devCap); } } @@ -121,7 +121,8 @@ void PluginInstallTask::stepParseConfigFile() } Catch(ValidationCore::ParserSchemaException::Base) { - _E("Error during file processing %s", m_context->pluginFilePath.getMetaFile().Fullpath().c_str()); + LogError("Error during file processing " << + m_context->pluginFilePath.getMetaFile()); ThrowMsg(Exceptions::PluginMetafileFailed, "Metafile error"); } @@ -132,8 +133,8 @@ void PluginInstallTask::stepFindPluginLibrary() if (m_dataFromConfigXML) { return; } - _D("Plugin installation: step find plugin library"); - _D("Plugin .so: %s", m_context->pluginFilePath.getLibraryName().c_str()); + LogDebug("Plugin installation: step find plugin library"); + LogDebug("Plugin .so: " << m_context->pluginFilePath.getLibraryName()); m_pluginInfo.m_libraryName = m_context->pluginFilePath.getLibraryName(); } @@ -149,11 +150,11 @@ void PluginInstallTask::stepCheckIfAlreadyInstalled() void PluginInstallTask::stepLoadPluginLibrary() { - _D("Plugin installation: step load library"); + LogDebug("Plugin installation: step load library"); DISABLE_IF_PLUGIN_WITHOUT_LIB() - _D("Loading plugin: %s", m_context->pluginFilePath.getLibraryName().c_str()); + LogDebug("Loading plugin: " << m_context->pluginFilePath.getLibraryName()); fprintf(stderr, " - Try to dlopen() : [%s] ", m_context->pluginFilePath.getLibraryPath().Fullpath().c_str()); @@ -163,7 +164,9 @@ void PluginInstallTask::stepLoadPluginLibrary() fprintf(stderr, "-> Failed!\n %s\n", (error != NULL ? error : "unknown")); - _E("Failed to load plugin: %s. Reason: %s", m_context->pluginFilePath.getLibraryName().c_str(), (error != NULL ? error : "unknown")); + LogError( + "Failed to load plugin: " << m_context->pluginFilePath.getLibraryName() << + ". Reason: " << (error != NULL ? error : "unknown")); ThrowMsg(Exceptions::PluginLibraryError, "Library error"); } @@ -186,7 +189,7 @@ void PluginInstallTask::stepLoadPluginLibrary() if (rawEntityList == NULL) { dlclose(dlHandle); - _E("Failed to read class name %s", m_context->pluginFilePath.getLibraryName().c_str()); + LogError("Failed to read class name" << m_context->pluginFilePath.getLibraryName()); ThrowMsg(Exceptions::PluginLibraryError, "Library error"); } @@ -197,7 +200,7 @@ void PluginInstallTask::stepLoadPluginLibrary() if (NULL == onWidgetInitProc) { dlclose(dlHandle); - _E("Failed to read onWidgetInit symbol %s", m_context->pluginFilePath.getLibraryName().c_str()); + LogError("Failed to read onWidgetInit symbol" << m_context->pluginFilePath.getLibraryName()); ThrowMsg(Exceptions::PluginLibraryError, "Library error"); } @@ -208,19 +211,19 @@ void PluginInstallTask::stepLoadPluginLibrary() if (!mappingInterface.featGetter || !mappingInterface.release || !mappingInterface.dcGetter) { - _E("Failed to obtain mapping interface from .so"); + LogError("Failed to obtain mapping interface from .so"); ThrowMsg(Exceptions::PluginLibraryError, "Library error"); } feature_mapping_t* devcapMapping = mappingInterface.featGetter(); - _D("Getting mapping from features to device capabilities"); + LogDebug("Getting mapping from features to device capabilities"); for (size_t i = 0; i < devcapMapping->featuresCount; ++i) { PluginMetafileData::Feature feature; feature.m_name = devcapMapping->features[i].feature_name; - _D("Feature: %s", feature.m_name.c_str()); + LogDebug("Feature: " << feature.m_name); const devcaps_t* dc = mappingInterface.dcGetter( @@ -228,11 +231,13 @@ void PluginInstallTask::stepLoadPluginLibrary() devcapMapping->features[i]. feature_name); + LogDebug("device=cap: " << dc); + if (dc) { - _D("devcaps count: %s", dc->devCapsCount); + LogDebug("devcaps count: " << dc->devCapsCount); for (size_t j = 0; j < dc->devCapsCount; ++j) { - _D("devcap: %s", dc->deviceCaps[j]); + LogDebug("devcap: " << dc->deviceCaps[j]); feature.m_deviceCapabilities.insert(dc->deviceCaps[j]); } } @@ -246,16 +251,18 @@ void PluginInstallTask::stepLoadPluginLibrary() m_libraryObjects = PluginObjectsPtr(new PluginObjects()); const js_entity_definition_t *rawEntityListIterator = rawEntityList; - _D("#####"); - _D("##### Plugin: %s supports new plugin API", m_context->pluginFilePath.getLibraryName().c_str()); - _D("#####"); + LogDebug("#####"); + LogDebug("##### Plugin: " + << m_context->pluginFilePath.getLibraryName() + << " supports new plugin API"); + LogDebug("#####"); while (rawEntityListIterator->parent_name != NULL && rawEntityListIterator->object_name != NULL) { - _D("##### [%s]: ", rawEntityListIterator->object_name); - _D("##### Parent: %s", rawEntityListIterator->parent_name); - _D("#####"); + LogDebug("##### [" << rawEntityListIterator->object_name << "]: "); + LogDebug("##### Parent: " << rawEntityListIterator->parent_name); + LogDebug("#####"); m_libraryObjects->addObjects(rawEntityListIterator->parent_name, rawEntityListIterator->object_name); @@ -265,20 +272,20 @@ void PluginInstallTask::stepLoadPluginLibrary() // Unload library if (dlclose(dlHandle) != 0) { - _E("Cannot close plugin handle"); + LogError("Cannot close plugin handle"); } else { - _D("Library is unloaded"); + LogDebug("Library is unloaded"); } // Load export table - _D("Library successfuly loaded and parsed"); + LogDebug("Library successfuly loaded and parsed"); SET_PLUGIN_INSTALL_PROGRESS(LOADING_LIBRARY, "Library loaded and analyzed"); } void PluginInstallTask::stepRegisterPlugin() { - _D("Plugin installation: step register Plugin"); + LogDebug("Plugin installation: step register Plugin"); m_pluginHandle = PluginDAO::registerPlugin(m_pluginInfo, m_context->pluginFilePath.Fullpath()); @@ -288,11 +295,11 @@ void PluginInstallTask::stepRegisterPlugin() void PluginInstallTask::stepRegisterFeatures() { - _D("Plugin installation: step register features"); + LogDebug("Plugin installation: step register features"); FOREACH(it, m_pluginInfo.m_featureContainer) { - _D("PluginHandle: %s", m_pluginHandle); + LogDebug("PluginHandle: " << m_pluginHandle); FeatureDAO::RegisterFeature(*it, m_pluginHandle); } SET_PLUGIN_INSTALL_PROGRESS(REGISTER_FEATURES, "Features registered"); @@ -300,7 +307,7 @@ void PluginInstallTask::stepRegisterFeatures() void PluginInstallTask::stepRegisterPluginObjects() { - _D("Plugin installation: step register objects"); + LogDebug("Plugin installation: step register objects"); DISABLE_IF_PLUGIN_WITHOUT_LIB() @@ -319,7 +326,7 @@ void PluginInstallTask::stepRegisterPluginObjects() FOREACH(it, *objects) { if (m_libraryObjects->hasObject(*it)) { - _D("Dependency from the same library. ignored"); + LogDebug("Dependency from the same library. ignored"); continue; } @@ -331,7 +338,7 @@ void PluginInstallTask::stepRegisterPluginObjects() void PluginInstallTask::stepResolvePluginDependencies() { - _D("Plugin installation: step resolve dependencies "); + LogDebug("Plugin installation: step resolve dependencies "); //DISABLE_IF_PLUGIN_WITHOUT_LIB if (m_pluginInfo.m_libraryName.empty()) { @@ -342,7 +349,7 @@ void PluginInstallTask::stepResolvePluginDependencies() //Installation completed m_context->pluginHandle = m_pluginHandle; m_context->installationCompleted = true; - _W("Plugin without library."); + LogWarning("Plugin without library."); return; } @@ -354,13 +361,13 @@ void PluginInstallTask::stepResolvePluginDependencies() FOREACH(it, *(m_libraryObjects->getDependentObjects())) { if (m_libraryObjects->hasObject(*it)) { - _D("Dependency from the same library. ignored"); + LogDebug("Dependency from the same library. ignored"); continue; } handle = PluginDAO::getPluginHandleForImplementedObject(*it); if (handle == INVALID_PLUGIN_HANDLE) { - _E("Library implementing: %s NOT FOUND", (*it).c_str()); + LogError("Library implementing: " << *it << " NOT FOUND"); PluginDAO::setPluginInstallationStatus( m_pluginHandle, PluginDAO::INSTALLATION_WAITING); diff --git a/src/jobs/plugin_install/plugin_objects.cpp b/src/jobs/plugin_install/plugin_objects.cpp index 9235f47..2747f8b 100644 --- a/src/jobs/plugin_install/plugin_objects.cpp +++ b/src/jobs/plugin_install/plugin_objects.cpp @@ -20,7 +20,7 @@ * @brief */ #include -#include +#include #include "plugin_objects.h" namespace { @@ -30,7 +30,7 @@ const std::string GLOBAL_OBJECT_NAME = "GLOBAL_OBJECT"; std::string normalizeName(const std::string& objectName) { if (objectName.empty()) { - _E("Normalize name, name size is 0"); + LogError("Normalize name, name size is 0"); return objectName; } @@ -48,7 +48,7 @@ std::string normalizeName(const std::string& objectName, const std::string& parentName) { if (objectName.empty() || parentName.empty()) { - _E("Normalize name, name size or parent name size is 0"); + LogError("Normalize name, name size or parent name size is 0"); return std::string(); } diff --git a/src/jobs/widget_install/ace_registration.cpp b/src/jobs/widget_install/ace_registration.cpp index 6596d47..b028ba5 100644 --- a/src/jobs/widget_install/ace_registration.cpp +++ b/src/jobs/widget_install/ace_registration.cpp @@ -21,11 +21,10 @@ */ #include +#include #include #include -#include - namespace { char* toAceString(const DPL::OptionalString& os) { @@ -51,7 +50,7 @@ bool registerAceWidget(const WrtDB::DbWidgetHandle& widgetHandle, const WrtDB::WidgetRegisterInfo& widgetConfig, const WrtDB::WidgetCertificateDataList& certList) { - _D("Updating Ace database"); + LogDebug("Updating Ace database"); struct widget_info wi; switch (widgetConfig.webAppType.appType) { @@ -59,7 +58,7 @@ bool registerAceWidget(const WrtDB::DbWidgetHandle& widgetHandle, wi.type = Tizen; break; default: - _E("Unknown application type"); + LogError("Unknown application type"); return false; } @@ -67,10 +66,10 @@ bool registerAceWidget(const WrtDB::DbWidgetHandle& widgetHandle, wi.version = toAceString(widgetConfig.configInfo.version); wi.author = toAceString(widgetConfig.configInfo.authorName); wi.shareHerf = strdup(widgetConfig.shareHref.c_str()); - _D("Basic data converted. Certificates begin."); + LogDebug("Basic data converted. Certificates begin."); //one more element for NULL termination - _D("Found: %d certificates", certList.size()); + LogDebug("Found: " << certList.size() << " certificates"); ace_certificate_data** certData = new ace_certificate_data * [certList.size() + 1]; certData[certList.size()] = NULL; // last element set to NULL @@ -87,7 +86,7 @@ bool registerAceWidget(const WrtDB::DbWidgetHandle& widgetHandle, certData[i]->owner = DISTRIBUTOR; break; default: - _D("Unknown owner type of cert"); + LogDebug("Unknown owner type of cert"); certData[i]->owner = UNKNOWN; break; } @@ -99,7 +98,7 @@ bool registerAceWidget(const WrtDB::DbWidgetHandle& widgetHandle, certData[i]->type = ROOT; break; default: - _E("Unknown type of cert"); + LogError("Unknown type of cert"); certData[i]->type = ENDENTITY; break; } @@ -112,7 +111,7 @@ bool registerAceWidget(const WrtDB::DbWidgetHandle& widgetHandle, ++i; } - _D("Registerign widget in ace"); + LogDebug("Registerign widget in ace"); ace_return_t retval = ace_register_widget( static_cast(widgetHandle), &wi, certData); @@ -137,7 +136,7 @@ bool registerAceWidget(const WrtDB::DbWidgetHandle& widgetHandle, bool registerAceWidgetFromDB(const WrtDB::DbWidgetHandle& widgetHandle) { using namespace WrtDB; - _D("Updating Ace database from Widget DB"); + LogDebug("Updating Ace database from Widget DB"); struct widget_info wi; DPL::OptionalString os; WrtDB::WidgetCertificateDataList certList; @@ -149,7 +148,7 @@ bool registerAceWidgetFromDB(const WrtDB::DbWidgetHandle& widgetHandle) if (type == WrtDB::APP_TYPE_TIZENWEBAPP) { wi.type = Tizen; } else { - _E("Unknown application type"); + LogError("Unknown application type"); return false; } @@ -157,16 +156,16 @@ bool registerAceWidgetFromDB(const WrtDB::DbWidgetHandle& widgetHandle) wi.version = toAceString(dao.getVersion()); wi.author = toAceString(dao.getAuthorName()); wi.shareHerf = strdup(dao.getShareHref().c_str()); - _D("Basic data converted. Certificates begin."); + LogDebug("Basic data converted. Certificates begin."); certList = dao.getCertificateDataList(); } Catch(WidgetDAOReadOnly::Exception::WidgetNotExist) { - _E("Widget does not exist"); + LogError("Widget does not exist"); return false; } //one more element for NULL termination - _D("Found: %d certificates", certList.size()); + LogDebug("Found: " << certList.size() << " certificates"); ace_certificate_data** certData = new ace_certificate_data * [certList.size() + 1]; certData[certList.size()] = NULL; // last element set to NULL @@ -183,7 +182,7 @@ bool registerAceWidgetFromDB(const WrtDB::DbWidgetHandle& widgetHandle) certData[i]->owner = DISTRIBUTOR; break; default: - _D("Unknown owner type of cert"); + LogDebug("Unknown owner type of cert"); certData[i]->owner = UNKNOWN; break; } @@ -195,7 +194,7 @@ bool registerAceWidgetFromDB(const WrtDB::DbWidgetHandle& widgetHandle) certData[i]->type = ROOT; break; default: - _E("Unknown type of cert"); + LogError("Unknown type of cert"); certData[i]->type = ENDENTITY; break; } @@ -208,7 +207,7 @@ bool registerAceWidgetFromDB(const WrtDB::DbWidgetHandle& widgetHandle) ++i; } - _D("Registerign widget in ace"); + LogDebug("Registerign widget in ace"); ace_return_t retval = ace_register_widget( static_cast(widgetHandle), &wi, certData); diff --git a/src/jobs/widget_install/directory_api.cpp b/src/jobs/widget_install/directory_api.cpp index 9ca0980..5edcf4c 100644 --- a/src/jobs/widget_install/directory_api.cpp +++ b/src/jobs/widget_install/directory_api.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include diff --git a/src/jobs/widget_install/job_widget_install.cpp b/src/jobs/widget_install/job_widget_install.cpp index 346ee3f..2761567 100644 --- a/src/jobs/widget_install/job_widget_install.cpp +++ b/src/jobs/widget_install/job_widget_install.cpp @@ -61,8 +61,6 @@ #include #include -#include - using namespace WrtDB; using namespace Jobs::Exceptions; @@ -91,7 +89,7 @@ JobWidgetInstall::JobWidgetInstall( void JobWidgetInstall::appendNewInstallationTaskList() { - _D("Configure installation succeeded"); + LogDebug("Configure installation succeeded"); m_installerContext.job->SetProgressFlag(true); AddTask(new TaskRecovery(m_installerContext)); @@ -122,8 +120,8 @@ void JobWidgetInstall::appendNewInstallationTaskList() void JobWidgetInstall::appendUpdateInstallationTaskList() { - _D("Configure installation updated"); - _D("Widget Update"); + LogDebug("Configure installation updated"); + LogDebug("Widget Update"); m_installerContext.job->SetProgressFlag(true); if (m_installerContext.mode.command == @@ -172,7 +170,7 @@ void JobWidgetInstall::appendUpdateInstallationTaskList() void JobWidgetInstall::appendFailureTaskList() { // Installation is not allowed to proceed due to widget update policy - _W("Configure installation failed!"); + LogWarning("Configure installation failed!"); GetInstallerStruct().pkgmgrInterface->sendSignal( PKGMGR_START_KEY, PKGMGR_START_INSTALL); @@ -195,7 +193,7 @@ void JobWidgetInstall::SendProgress() PKGMGR_PROGRESS_KEY, percent.str()); - _D("Call widget install progressCallback"); + LogPedantic("Call widget install progressCallback"); GetInstallerStruct().progressCallback( GetInstallerStruct().userParam, GetProgressPercent(), @@ -245,7 +243,7 @@ void JobWidgetInstall::SendFinishedSuccess() PKGMGR_END_KEY, PKGMGR_END_SUCCESS); - _D("Call widget install successfinishedCallback"); + LogDebug("Call widget install successfinishedCallback"); GetInstallerStruct().finishedCallback(GetInstallerStruct().userParam, DPL::ToUTF8String( tizenId), Jobs::Exceptions::Success); @@ -257,11 +255,11 @@ void JobWidgetInstall::SendFinishedFailure() // remove widget install information file unlink(m_installerContext.installInfo.c_str()); - _E("Error number: %d", m_exceptionCaught); - _E("Message: %s", m_exceptionMessage.c_str()); + LogError("Error number: " << m_exceptionCaught); + LogError("Message: " << m_exceptionMessage); TizenAppId & tizenId = m_installerContext.widgetConfig.tzAppid; - _D("Call widget install failure finishedCallback"); + LogDebug("Call widget install failure finishedCallback"); std::stringstream errorNum; errorNum << m_exceptionCaught; @@ -344,7 +342,7 @@ void JobWidgetInstall::displayWidgetInfo() out << std::endl; - _D("%s", out.str().c_str()); + LogDebug(out.str()); } } //namespace WidgetInstall } //namespace Jobs diff --git a/src/jobs/widget_install/task_ace_check.cpp b/src/jobs/widget_install/task_ace_check.cpp index cf44fc0..938049f 100644 --- a/src/jobs/widget_install/task_ace_check.cpp +++ b/src/jobs/widget_install/task_ace_check.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -35,8 +36,6 @@ #include #include -#include - namespace Jobs { namespace WidgetInstall { TaskAceCheck::TaskAceCheck(InstallerContext& context) : @@ -63,24 +62,24 @@ void TaskAceCheck::StepPrepareForAce() void TaskAceCheck::StepAceCheck() { WrtDB::WidgetDAO dao(m_context.widgetConfig.tzAppid); - _D("StepAceCheck!"); + LogDebug("StepAceCheck!"); // This widget does not use any device cap if (m_context.featureLogic->isDone()) { return; } - _D("StepAceCheck!"); + LogDebug("StepAceCheck!"); DPL::String deviceCap = m_context.featureLogic->getDevice(); - _D("StepAceCheck!"); - _D("DevCap is : %ls", deviceCap.c_str()); + LogDebug("StepAceCheck!"); + LogDebug("DevCap is : " << deviceCap); std::string devCapStr = DPL::ToUTF8String(deviceCap); ace_policy_result_t policyResult = ACE_DENY; //TODO: remove dao.getHandle() if (m_context.mode.installTime == InstallMode::InstallTime::PRELOAD) { - _D("This widget is preloaded. So ace check will be skiped"); + LogDebug("This widget is preloaded. So ace check will be skiped"); policyResult = ACE_PERMIT; } else { ace_return_t ret = ace_get_policy_result( @@ -93,7 +92,7 @@ void TaskAceCheck::StepAceCheck() } } - _D("PolicyResult is : %d", static_cast(policyResult)); + LogDebug("PolicyResult is : " << static_cast(policyResult)); m_context.staticPermittedDevCaps.insert(std::make_pair(deviceCap, policyResult == ACE_PERMIT)); @@ -110,18 +109,19 @@ void TaskAceCheck::StepProcessAceResponse() return; } - _D("StepProcessAceResponse"); + LogDebug("StepProcessAceResponse"); m_context.featureLogic->next(); // No device caps left to process if (m_context.featureLogic->isDone()) { - _D("All responses has been received from ACE."); + LogDebug("All responses has been received from ACE."); // Data to convert to C API std::vector devCaps; std::vector devCapsSmack; // Saving static dev cap permissions FOREACH(cap, m_context.staticPermittedDevCaps) { - _D("staticPermittedDevCaps : %ls smack: %d", cap->first.c_str(), cap->second); + LogDebug("staticPermittedDevCaps : " << cap->first + << " smack: " << cap->second); std::string devCapStr = DPL::ToUTF8String(cap->first); devCaps.push_back(devCapStr); devCapsSmack.push_back(cap->second); @@ -160,7 +160,7 @@ void TaskAceCheck::StepProcessAceResponse() for (std::set::const_iterator iter = acceptedFeature.begin(); iter != acceptedFeature.end(); ++iter) { - _D("Accepted feature item: %s", iter->c_str()); + LogDebug("Accepted feature item: " << iter->c_str()); featureList.items[i] = const_cast(iter->c_str()); i++; } @@ -171,44 +171,46 @@ void TaskAceCheck::StepProcessAceResponse() delete[] featureList.items; if (ACE_OK != ret) { - _E("Error in ace_set_feature"); + LogError("Error in ace_set_feature"); ThrowMsg(Exceptions::AceCheckFailed, "Instalation failure. " "ace_set_feature failure."); } return; } - _D("Next device cap."); + LogDebug("Next device cap."); // Process next device cap SwitchToStep(&TaskAceCheck::StepAceCheck); } void TaskAceCheck::StepCheckAceResponse() { - _D("Checking ACE response"); + LogDebug("Checking ACE response"); if (m_context.featureLogic->isRejected()) { - _E("Installation failure. Some devCap was not accepted by ACE."); + LogError("Installation failure. Some devCap was not accepted by ACE."); ThrowMsg( Exceptions::PrivilegeLevelViolation, "Instalation failure. " "Some deviceCap was not accepted by ACE."); } - _D("Updating \"feature reject status\" in database!"); + LogDebug("Updating \"feature reject status\" in database!"); auto it = m_context.featureLogic->resultBegin(); auto end = m_context.featureLogic->resultEnd(); for (; it != end; ++it) { - _D(" |- Feature: %ls has reject status: %d", it->name.c_str(), it->rejected); + LogDebug( + " |- Feature: " << it->name << " has reject status: " << + it->rejected); if (it->rejected) { WrtDB::WidgetDAO dao(m_context.widgetConfig.tzAppid); dao.updateFeatureRejectStatus(*it); } } - _D("Installation continues..."); + LogDebug("Installation continues..."); } void TaskAceCheck::StartStep() { - _D("--------- : START ----------"); + LogDebug("--------- : START ----------"); } void TaskAceCheck::EndStep() @@ -217,7 +219,7 @@ void TaskAceCheck::EndStep() InstallerContext::INSTALL_ACE_CHECK, "Widget Access Control Check Finished"); - _D("--------- : END ----------"); + LogDebug("--------- : END ----------"); } } //namespace WidgetInstall } //namespace Jobs diff --git a/src/jobs/widget_install/task_certify.cpp b/src/jobs/widget_install/task_certify.cpp index 0798ab3..8dc83c0 100644 --- a/src/jobs/widget_install/task_certify.cpp +++ b/src/jobs/widget_install/task_certify.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include "wac_widget_id.h" @@ -46,8 +47,6 @@ #include #include -#include - using namespace ValidationCore; using namespace WrtDB; @@ -59,7 +58,7 @@ WidgetCertificateData toWidgetCertificateData(const SignatureData &data, WidgetCertificateData result; result.chainId = data.getSignatureNumber(); - _D("result.chainId : %d", result.chainId); + LogDebug("result.chainId : " << result.chainId); result.owner = data.isAuthorSignature() ? WidgetCertificateData::AUTHOR : WidgetCertificateData::DISTRIBUTOR; @@ -100,11 +99,11 @@ CertificatePtr getOldAuthorSignerCertificate(DPL::String appid) { ValidationCore::CertificateCollection chain; if (false == chain.load(*it)) { - _E("Chain is broken"); + LogError("Chain is broken"); } if (!chain.sort()) { - _E("Chain failed at sorting"); + LogError("Chain failed at sorting"); } ValidationCore::CertificateList list = chain.getCertificateList(); @@ -164,7 +163,7 @@ void TaskCertify::processDistributorSignature(const SignatureData &data) void TaskCertify::processAuthorSignature(const SignatureData &data) { using namespace ValidationCore; - _D("DNS Identity match!"); + LogDebug("DNS Identity match!"); // this signature is verified or widget is distributor signed m_contextData.widgetSecurity.setAuthorCertificatePtr(data.getEndEntityCertificatePtr()); CertificatePtr test = m_contextData.widgetSecurity.getAuthorCertificatePtr(); @@ -201,11 +200,11 @@ void TaskCertify::processAuthorSignature(const SignatureData &data) void TaskCertify::getSignatureFiles(std::string path, SignatureFileInfoSet& file) { - _D("path : %s", path.c_str()); + LogDebug("path : " << path); SignatureFileInfoSet signatureFiles; SignatureFinder signatureFinder(path); if (SignatureFinder::NO_ERROR != signatureFinder.find(file)) { - _E("Error in Signature Finder : %s", path.c_str()); + LogError("Error in Signature Finder : " << path); ThrowMsg(Exceptions::SignatureNotFound, "Error openig temporary widget directory"); } @@ -213,7 +212,7 @@ void TaskCertify::getSignatureFiles(std::string path, SignatureFileInfoSet& file void TaskCertify::stepSignature() { - _D("================ Step: <> ENTER ==============="); + LogDebug("================ Step: <> ENTER ==============="); std::string widgetPath; widgetPath = m_contextData.locations->getTemporaryPackageDir() + "/"; @@ -241,10 +240,10 @@ void TaskCertify::stepSignature() } SignatureFileInfoSet::reverse_iterator iter = signatureFiles.rbegin(); - _D("Number of signatures: %d", signatureFiles.size()); + LogDebug("Number of signatures: " << signatureFiles.size()); for (; iter != signatureFiles.rend(); ++iter) { - _D("Checking signature with id=%d", iter->getFileNumber()); + LogDebug("Checking signature with id=" << iter->getFileNumber()); SignatureData data(widgetPath + iter->getFileName(), iter->getFileNumber()); @@ -272,14 +271,14 @@ void TaskCertify::stepSignature() } if (result == WrtSignatureValidator::SIGNATURE_REVOKED) { - _W("Certificate is REVOKED"); + LogWarning("Certificate is REVOKED"); ThrowMsg(Exceptions::CertificateExpired, "Certificate is REVOKED"); } if (result == WrtSignatureValidator::SIGNATURE_INVALID && iter->getFileNumber() <= 1) { - _W("Signature is INVALID"); + LogWarning("Signature is INVALID"); // TODO change exception name ThrowMsg(Exceptions::SignatureInvalid, "Invalid Package"); @@ -295,17 +294,17 @@ void TaskCertify::stepSignature() } } } Catch(ParserSchemaException::Base) { - _E("Error occured in ParserSchema."); + LogError("Error occured in ParserSchema."); ReThrowMsg(Exceptions::SignatureInvalid, "Error occured in ParserSchema."); } } if (signatureFiles.empty()) { - _D("No signature files has been found."); + LogDebug("No signature files has been found."); } - _D("================ Step: <> DONE ================"); + LogDebug("================ Step: <> DONE ================"); m_contextData.job->UpdateProgress( InstallerContext::INSTALL_DIGSIG_CHECK, @@ -326,7 +325,7 @@ bool TaskCertify::isTizenWebApp() const void TaskCertify::stepVerifyUpdate() { - _D("Step: <>"); + LogDebug("Step: <>"); CertificatePtr newCertificate = m_contextData.widgetSecurity.getAuthorCertificatePtr(); CertificatePtr oldCertificate = @@ -334,8 +333,10 @@ void TaskCertify::stepVerifyUpdate() if (!!newCertificate && !!oldCertificate) { if (0 != newCertificate->getBase64().compare(oldCertificate->getBase64())) { - _D("old widget's author signer certificate : %ls", oldCertificate->getBase64().c_str()); - _D("new widget's author signer certificate : %ls", newCertificate->getBase64().c_str()); + LogDebug("old widget's author signer certificate : " << + oldCertificate->getBase64()); + LogDebug("new widget's author signer certificate : " << + newCertificate->getBase64()); ThrowMsg(Exceptions::NotMatchedCertification, "Author signer certificates doesn't match \ between old widget and installing widget"); @@ -351,18 +352,18 @@ void TaskCertify::stepVerifyUpdate() void TaskCertify::StartStep() { - _D("--------- : START ----------"); + LogDebug("--------- : START ----------"); } void TaskCertify::EndStep() { - _D("Step: <>"); + LogDebug("Step: <>"); m_contextData.job->UpdateProgress( InstallerContext::INSTALL_CERT_CHECK, "Widget Certification Check Finished"); - _D("--------- : END ----------"); + LogDebug("--------- : END ----------"); } } //namespace WidgetInstall } //namespace Jobs diff --git a/src/jobs/widget_install/task_certify_level.cpp b/src/jobs/widget_install/task_certify_level.cpp index 55fcad0..1a2b442 100644 --- a/src/jobs/widget_install/task_certify_level.cpp +++ b/src/jobs/widget_install/task_certify_level.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -43,8 +44,6 @@ #include #include -#include - using namespace ValidationCore; using namespace WrtDB; @@ -61,11 +60,11 @@ TaskCertifyLevel::TaskCertifyLevel(InstallerContext &inCont) : void TaskCertifyLevel::stepCertifyLevel() { - _D("================ Step: <> ENTER ==============="); + LogDebug("================ Step: <> ENTER ==============="); if (!checkConfigurationLevel(getCertifyLevel())) { ThrowMsg(Exceptions::PrivilegeLevelViolation, "setting level violate"); } - _D("================ Step: <> DONE ================"); + LogDebug("================ Step: <> DONE ================"); } void TaskCertifyLevel::getSignatureFiles(const std::string& path, @@ -74,7 +73,7 @@ void TaskCertifyLevel::getSignatureFiles(const std::string& path, SignatureFileInfoSet signatureFiles; SignatureFinder signatureFinder(path); if (SignatureFinder::NO_ERROR != signatureFinder.find(file)) { - _E("Error in Signature Finder : %s", path.c_str()); + LogError("Error in Signature Finder : " << path); ThrowMsg(Exceptions::SignatureNotFound, "Signature not found"); } } @@ -106,11 +105,11 @@ TaskCertifyLevel::Level TaskCertifyLevel::getCertifyLevel() } SignatureFileInfoSet::reverse_iterator iter = signatureFiles.rbegin(); - _D("Number of signatures: %d", signatureFiles.size()); + LogDebug("Number of signatures: " << signatureFiles.size()); Level level = Level::UNKNOWN; for (; iter != signatureFiles.rend(); ++iter) { - _D("Checking signature with id=%d", iter->getFileNumber()); + LogDebug("Checking signature with id=" << iter->getFileNumber()); SignatureData data(widgetPath + iter->getFileName(), iter->getFileNumber()); @@ -148,7 +147,7 @@ TaskCertifyLevel::Level TaskCertifyLevel::getCertifyLevel() } if (data.isAuthorSignature()) { - _D("Skip author signature"); + LogDebug("Skip author signature"); } else { Level currentCertLevel = certTypeToLevel(data.getVisibilityLevel()); @@ -157,11 +156,11 @@ TaskCertifyLevel::Level TaskCertifyLevel::getCertifyLevel() } if (currentCertLevel > level) { level = currentCertLevel; - _D("level %s", enumToString(level).c_str()); + LogDebug("level " << enumToString(level)); } } } Catch(ParserSchemaException::Base) { - _E("Error occured in ParserSchema."); + LogError("Error occured in ParserSchema."); ReThrowMsg(Exceptions::SignatureInvalid, "Error occured in ParserSchema."); } @@ -193,7 +192,11 @@ bool TaskCertifyLevel::checkSettingLevel( secureSettingIter ret = data.find(DPL::ToUTF8String(it->m_name)); if (ret != data.end()) { if (level < ret->second) { - _E("\"%s\" needs \"%s\" level", it->m_name.c_str(), enumToString(ret->second).c_str()); + LogError("\"" << + it->m_name << + "\" needs \"" << + enumToString(ret->second) << + "\" level"); return false; } } @@ -210,7 +213,9 @@ bool TaskCertifyLevel::checkAppcontrolHasDisposition( it->m_disposition) { if (level < Level::PLATFORM) { - _E("\"tizen:disposition\" needs \"%s \" level", enumToString(Level::PLATFORM).c_str()); + LogError("\"tizen:disposition\" needs \"" << + enumToString(Level::PLATFORM) << + "\" level"); return false; } } @@ -255,12 +260,12 @@ TaskCertifyLevel::Level TaskCertifyLevel::certTypeToLevel( void TaskCertifyLevel::StartStep() { - _D("--------- : START ----------"); + LogDebug("--------- : START ----------"); } void TaskCertifyLevel::EndStep() { - _D("--------- : END ----------"); + LogDebug("--------- : END ----------"); m_contextData.job->UpdateProgress( InstallerContext::INSTALL_CERTIFY_LEVEL_CHECK, diff --git a/src/jobs/widget_install/task_commons.cpp b/src/jobs/widget_install/task_commons.cpp index c5b5b67..3935cfb 100644 --- a/src/jobs/widget_install/task_commons.cpp +++ b/src/jobs/widget_install/task_commons.cpp @@ -26,11 +26,11 @@ #include #include #include +#include #include #include #include #include -#include namespace Jobs { namespace WidgetInstall { @@ -41,7 +41,7 @@ const mode_t TEMPORARY_PATH_MODE = 0775; std::string createTempPath(bool preload) { - _D("Step: Creating temporary path"); + LogDebug("Step: Creating temporary path"); // Temporary path std::ostringstream tempPathBuilder; diff --git a/src/jobs/widget_install/task_configuration.cpp b/src/jobs/widget_install/task_configuration.cpp index e8bf0ed..53fdfba 100644 --- a/src/jobs/widget_install/task_configuration.cpp +++ b/src/jobs/widget_install/task_configuration.cpp @@ -53,8 +53,6 @@ #include #include -#include - using namespace WrtDB; namespace { @@ -79,11 +77,12 @@ const std::string XML_EXTENSION = ".xml"; bool hasExtension(const std::string& filename, const std::string& extension) { - _D("Looking for extension %s in %s", extension.c_str(), filename.c_str()); + LogDebug("Looking for extension " << extension << " in: " << filename); size_t fileLen = filename.length(); size_t extLen = extension.length(); if (fileLen < extLen) { - _E("Filename %s is shorter than extension %s", filename.c_str(), extension.c_str()); + LogError("Filename " << filename << " is shorter than extension " + << extension); return false; } return (0 == filename.compare(fileLen - extLen, extLen, extension)); @@ -106,12 +105,12 @@ TaskConfiguration::TaskConfiguration(InstallerContext& context) : void TaskConfiguration::StartStep() { - _D("--------- : START ----------"); + LogDebug("--------- : START ----------"); } void TaskConfiguration::EndStep() { - _D("--------- : END ----------"); + LogDebug("--------- : END ----------"); } void TaskConfiguration::AppendTasklistStep() @@ -120,13 +119,13 @@ void TaskConfiguration::AppendTasklistStep() m_context.confResult = m_result; if (m_result == ConfigureResult::Ok) { - _D("TaskConfiguration -> new installation task list"); + LogInfo("TaskConfiguration -> new installation task list"); m_context.job->appendNewInstallationTaskList(); } else if (m_result == ConfigureResult::Updated) { - _D("TaskConfiguration -> update installation task list"); + LogInfo("TaskConfiguration -> update installation task list"); m_context.job->appendUpdateInstallationTaskList(); } else { - _D("TaskConfiguration -> failure task list"); + LogInfo("TaskConfiguration -> failure task list"); m_context.job->appendFailureTaskList(); } } @@ -161,8 +160,8 @@ void TaskConfiguration::PrepareInstallationStep() wgtUnzip.unzipWgtFile(widgetPath, tempDir); } - _D("widgetPath:%s", widgetPath.c_str()); - _D("tempPath:%s", tempDir.c_str()); + LogDebug("widgetPath:" << widgetPath); + LogDebug("tempPath:" << tempDir); m_context.widgetConfig.packagingType = checkPackageType(widgetPath, tempDir); @@ -171,7 +170,8 @@ void TaskConfiguration::PrepareInstallationStep() tempDir, m_context.widgetConfig.packagingType, m_context.mode.command == InstallMode::Command::REINSTALL); - _D("widget packaging type : %d", m_context.widgetConfig.packagingType.pkgType); + LogDebug("widget packaging type : " << + m_context.widgetConfig.packagingType.pkgType); setTizenId(configData); setApplicationType(configData); @@ -180,7 +180,7 @@ void TaskConfiguration::PrepareInstallationStep() // TODO: (job_install_refactoring) hide this call m_context.callerPkgId = DPL::FromUTF8String(m_context.job->GetInstallerStruct().pkgmgrInterface->getCallerId()); - _D("Caller Package Id : %s", m_context.callerPkgId.c_str()); + LogDebug("Caller Package Id : " << m_context.callerPkgId); // Configure installation result = ConfigureInstallation(widgetPath, configData, tempDir); @@ -191,32 +191,32 @@ void TaskConfiguration::PrepareInstallationStep() } Catch(Exceptions::OpenZipFailed) { - _E("Failed to unzip for widget"); + LogError("Failed to unzip for widget"); result = ConfigureResult::Failed_OpenZipError; } Catch(Exceptions::ExtractFileFailed) { - _E("Failed to unzip for widget"); + LogError("Failed to unzip for widget"); result = ConfigureResult::Failed_UnzipError; } Catch(Exceptions::DrmDecryptFailed) { - _E("Failed to unzip for widget"); + LogError("Failed to unzip for widget"); result = ConfigureResult::Failed_DrmError; } Catch(Exceptions::MissingConfig) { - _E("Failed to localize config.xml"); + LogError("Failed to localize config.xml"); result = ConfigureResult::Failed_InvalidConfig; } Catch(Exceptions::WidgetConfigFileInvalid) { - _E("Invalid configuration file"); + LogError("Invalid configuration file"); result = ConfigureResult::Failed_InvalidConfig; } Catch(DPL::Exception) { - _E("Unknown exception"); + LogError("Unknown exception"); result = ConfigureResult::Failed; } @@ -229,11 +229,15 @@ void TaskConfiguration::setTizenId( bool shouldMakeAppid = false; using namespace PackageManager; if (!!configInfo.tizenAppId) { - _D("Setting tizenAppId provided in config.xml: %ls", (*configInfo.tizenAppId).c_str()); + LogDebug("Setting tizenAppId provided in config.xml: " << + configInfo.tizenAppId); + m_context.widgetConfig.tzAppid = *configInfo.tizenAppId; //check package id. if (!!configInfo.tizenPkgId) { - _D("Setting tizenPkgId provided in config.xml: %ls", (*configInfo.tizenPkgId).c_str()); + LogDebug("Setting tizenPkgId provided in config.xml: " << + configInfo.tizenPkgId); + m_context.widgetConfig.tzPkgid = *configInfo.tizenPkgId; } else { DPL::String appid = *configInfo.tizenAppId; @@ -251,7 +255,7 @@ void TaskConfiguration::setTizenId( } else { shouldMakeAppid = true; TizenPkgId pkgId = WidgetDAOReadOnly::generatePkgId(); - _D("Checking if pkg id is unique"); + LogDebug("Checking if pkg id is unique"); while (true) { if (!validateTizenPackageID(pkgId)) { //path exist, chose another one @@ -261,7 +265,8 @@ void TaskConfiguration::setTizenId( break; } m_context.widgetConfig.tzPkgid = pkgId; - _D("tizen_id name was generated by WRT: %s", m_context.widgetConfig.tzPkgid.c_str()); + LogDebug("tizen_id name was generated by WRT: " << + m_context.widgetConfig.tzPkgid); } if (shouldMakeAppid == true) { @@ -283,10 +288,10 @@ void TaskConfiguration::setTizenId( } regex_t regx; if (regcomp(®x, REG_NAME_PATTERN, REG_NOSUB | REG_EXTENDED) != 0) { - _D("Regcomp failed"); + LogDebug("Regcomp failed"); } - _D("Name : %ls", (*name).c_str()); + LogDebug("Name : " << name); if (!name || (regexec(®x, DPL::ToUTF8String(*name).c_str(), static_cast(0), NULL, 0) != REG_NOERROR)) { @@ -299,13 +304,13 @@ void TaskConfiguration::setTizenId( genName << "_" << allowedString[rand_r(&seed) % allowedString.length()]; name = DPL::FromUTF8String(genName.str()); - _D("name was generated by WRT"); + LogDebug("name was generated by WRT"); } regfree(®x); - _D("Name : %ls", (*name).c_str()); + LogDebug("Name : " << name); std::ostringstream genid; genid << m_context.widgetConfig.tzPkgid << "." << name; - _D("tizen appid was generated by WRT : %s", genid.str().c_str()); + LogDebug("tizen appid was generated by WRT : " << genid.str()); DPL::OptionalString appid = DPL::FromUTF8String(genid.str()); NormalizeAndTrimSpaceString(appid); @@ -318,10 +323,9 @@ void TaskConfiguration::setTizenId( m_context. widgetConfig. tzPkgid)); - _D("Tizen App Id : %ls", (m_context.widgetConfig.tzAppid).c_str()); - _D("Tizen Pkg Id : %ls", (m_context.widgetConfig.tzPkgid).c_str()); - _D("W3C Widget GUID : %ls", (*m_context.widgetConfig.guid).c_str()); - + LogDebug("Tizen App Id : " << m_context.widgetConfig.tzAppid); + LogDebug("Tizen Pkg Id : " << m_context.widgetConfig.tzPkgid); + LogDebug("W3C Widget GUID : " << m_context.widgetConfig.guid); } void TaskConfiguration::configureWidgetLocation(const std::string & widgetPath, @@ -338,7 +342,7 @@ void TaskConfiguration::configureWidgetLocation(const std::string & widgetPath, m_context.locations->registerAppid( DPL::ToUTF8String(m_context.widgetConfig.tzAppid)); - _D("widgetSource %s", widgetPath.c_str()); + LogDebug("widgetSource " << widgetPath); } ConfigureResult TaskConfiguration::ConfigureInstallation( @@ -382,11 +386,11 @@ ConfigureResult TaskConfiguration::ConfigureInstallation( if (!validateTizenApplicationID( m_context.widgetConfig.tzAppid)) { - _E("tizen application ID is already used"); + LogError("tizen application ID is already used"); return ConfigureResult::Failed_InvalidConfig; } if (!validateTizenPackageID(m_context.widgetConfig.tzPkgid)) { - _E("tizen package ID is already used"); + LogError("tizen package ID is already used"); return ConfigureResult::Failed_AlreadyInstalled; } } @@ -399,11 +403,11 @@ ConfigureResult TaskConfiguration::ConfigureInstallation( bool TaskConfiguration::validateTizenApplicationID( const WrtDB::TizenAppId &tizenAppId) { - _D("tizen application ID = [%ls]", tizenAppId.c_str()); + LogDebug("tizen application ID = [" << tizenAppId << "]"); regex_t reg; if (regcomp(®, REG_TIZENID_PATTERN, REG_NOSUB | REG_EXTENDED) != 0) { - _D("Regcomp failed"); + LogDebug("Regcomp failed"); } if (regexec(®, DPL::ToUTF8String(tizenAppId).c_str(), 0, NULL, 0) @@ -440,9 +444,9 @@ ConfigureResult TaskConfiguration::checkWidgetUpdate( return ConfigureResult::Failed; } - _D("existing version = '%ls", update.existingVersion->Raw().c_str()); - _D("incoming version = '%ls", update.incomingVersion->Raw().c_str()); - _D("Tizen AppID = %ls", update.tzAppId.c_str()); + LogDebug("existing version = '" << update.existingVersion); + LogDebug("incoming version = '" << update.incomingVersion); + LogDebug("Tizen AppID = " << update.tzAppId); // Check running state bool isRunning = false; @@ -450,7 +454,7 @@ ConfigureResult TaskConfiguration::checkWidgetUpdate( app_manager_is_running(DPL::ToUTF8String(update.tzAppId).c_str(), &isRunning); if (APP_MANAGER_ERROR_NONE != ret) { - _E("Fail to get running state"); + LogError("Fail to get running state"); return ConfigureResult::Failed_WidgetRunning; } @@ -463,14 +467,14 @@ ConfigureResult TaskConfiguration::checkWidgetUpdate( DPL::ToUTF8String(update.tzAppId).c_str(), &appCtx); if (APP_MANAGER_ERROR_NONE != ret) { - _E("Fail to get app_context"); + LogError("Fail to get app_context"); return ConfigureResult::Failed_WidgetRunning; } // terminate app_context_h ret = app_manager_terminate_app(appCtx); if (APP_MANAGER_ERROR_NONE != ret) { - _E("Fail to terminate running application"); + LogError("Fail to terminate running application"); app_context_destroy(appCtx); return ConfigureResult::Failed_WidgetRunning; } else { @@ -487,7 +491,7 @@ ConfigureResult TaskConfiguration::checkWidgetUpdate( DPL::ToUTF8String(update.tzAppId).c_str(), &isStillRunning); if (APP_MANAGER_ERROR_NONE != ret) { - _E("Fail to get running state"); + LogError("Fail to get running state"); return ConfigureResult::Failed_WidgetRunning; } if (!isStillRunning) { @@ -495,10 +499,10 @@ ConfigureResult TaskConfiguration::checkWidgetUpdate( } } if (isStillRunning) { - _E("Fail to terminate running application"); + LogError("Fail to terminate running application"); return ConfigureResult::Failed_WidgetRunning; } - _D("terminate application"); + LogDebug("terminate application"); } } @@ -564,16 +568,16 @@ ConfigParserData TaskConfiguration::getWidgetDataFromXML( } Catch(ElementParser::Exception::ParseError) { - _E("Failed to parse config.xml file"); + LogError("Failed to parse config.xml file"); return ConfigParserData(); } Catch(WidgetDAOReadOnly::Exception::WidgetNotExist) { - _E("Failed to find installed widget - give proper tizenId"); + LogError("Failed to find installed widget - give proper tizenId"); return ConfigParserData(); } Catch(Exceptions::WidgetConfigFileNotFound){ - _E("Failed to find config.xml"); + LogError("Failed to find config.xml"); return ConfigParserData(); } @@ -584,7 +588,7 @@ WidgetUpdateInfo TaskConfiguration::detectWidgetUpdate( const ConfigParserData &configInfo, const WrtDB::TizenAppId &tizenId) { - _D("Checking up widget package for config.xml..."); + LogDebug("Checking up widget package for config.xml..."); OptionalWidgetVersion incomingVersion; if (!configInfo.version.IsNull()) { @@ -613,7 +617,7 @@ WrtDB::PackagingType TaskConfiguration::checkPackageType( const std::string &tempPath) { if (hasExtension(widgetSource, XML_EXTENSION)) { - _D("Hosted app installation"); + LogDebug("Hosted app installation"); return PKG_TYPE_HOSTED_WEB_APP; } @@ -630,25 +634,27 @@ void TaskConfiguration::setApplicationType( { AppType widgetAppType = APP_TYPE_UNKNOWN; FOREACH(iterator, configInfo.nameSpaces) { - _D("namespace = [%ls]", (*iterator).c_str()); + LogDebug("namespace = [" << *iterator << "]"); if (*iterator == ConfigurationNamespace::TizenWebAppNamespaceName) { if (widgetAppType != APP_TYPE_UNKNOWN && widgetAppType != APP_TYPE_TIZENWEBAPP) { - _E("To many namespaces declared in configuration fileA."); + LogError("To many namespaces declared in configuration fileA."); ThrowMsg(Exceptions::WidgetConfigFileInvalid, "Config.xml has more than one valid namespace"); } widgetAppType = APP_TYPE_TIZENWEBAPP; } else { - _D("Namespace ignored."); + LogDebug("Namespace ignored."); } } m_context.widgetConfig.webAppType = widgetAppType; - _D("type = [%s]", m_context.widgetConfig.webAppType.getApptypeToString().c_str()); + LogDebug("type = [" << + m_context.widgetConfig.webAppType.getApptypeToString() << + "]"); } bool TaskConfiguration::detectResourceEncryption( @@ -659,7 +665,7 @@ bool TaskConfiguration::detectResourceEncryption( if (it->m_name == SETTING_VALUE_ENCRYPTION && it->m_value == SETTING_VALUE_ENCRYPTION_ENABLE) { - _D("resource need encryption"); + LogDebug("resource need encryption"); return true; } } @@ -676,7 +682,7 @@ void TaskConfiguration::setInstallLocationType( it->m_value == SETTING_VALUE_INSTALLTOEXT_PREPER_EXT) { - _D("This widget will be installed to sd card"); + LogDebug("This widget will be installed to sd card"); m_context.locationType = INSTALL_LOCATION_TYPE_EXTERNAL; } @@ -711,7 +717,7 @@ bool TaskConfiguration::checkSupportRDSUpdate(const WrtDB::ConfigParserData } } if (configValue != dbValue) { - _E("Not Support RDS mode because of encryption setting"); + LogError("Not Support RDS mode because of encryption setting"); return false; } } diff --git a/src/jobs/widget_install/task_database.cpp b/src/jobs/widget_install/task_database.cpp index 6ab2c72..90ac7c9 100644 --- a/src/jobs/widget_install/task_database.cpp +++ b/src/jobs/widget_install/task_database.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -45,7 +46,6 @@ #include #include #include -#include using namespace WrtDB; @@ -80,7 +80,7 @@ void TaskDatabase::StepWrtDBInsert() time(&m_context.widgetConfig.installedTime); if (m_context.isUpdateMode) { //update - _D("Registering widget... (update)"); + LogDebug("Registering widget... (update)"); Try { m_handleToRemove = WidgetDAOReadOnly::getHandle( @@ -93,7 +93,7 @@ void TaskDatabase::StepWrtDBInsert() } Catch(WidgetDAOReadOnly::Exception::WidgetNotExist) { - _E( + LogError( "Given tizenId not found for update installation (Same GUID?)"); ThrowMsg(Exceptions::DatabaseFailure, "Given tizenId not found for update installation"); @@ -107,7 +107,7 @@ void TaskDatabase::StepWrtDBInsert() m_handle = WidgetDAOReadOnly::getHandle(m_context.widgetConfig.tzAppid); } else { //new installation - _D("Registering widget..."); + LogDebug("Registering widget..."); WidgetDAO::registerWidget( m_context.widgetConfig.tzAppid, m_context.widgetConfig, @@ -117,32 +117,35 @@ void TaskDatabase::StepWrtDBInsert() } FOREACH(cap, m_context.staticPermittedDevCaps) { - _D("staticPermittedDevCaps : %ls smack status: %d", cap->first.c_str(), cap->second); + LogDebug( + "staticPermittedDevCaps : " << cap->first + << " smack status: " << + cap->second); } - _D("Widget registered"); + LogDebug("Widget registered"); } Catch(WidgetDAO::Exception::DatabaseError) { - _E("Database failure!"); + LogError("Database failure!"); ReThrowMsg(Exceptions::InsertNewWidgetFailed, "Database failure!"); } Catch(DPL::DB::SqlConnection::Exception::Base) { - _E("Database failure!"); + LogError("Database failure!"); ReThrowMsg(Exceptions::InsertNewWidgetFailed, "Database failure!"); } } void TaskDatabase::StepAceDBInsert() { - _D("Inserting Ace database entry. New handle: %d", m_handle); + LogDebug("Inserting Ace database entry. New handle: " << m_handle); if (INVALID_WIDGET_HANDLE != m_handleToRemove) { - _D("Removing old insallation. Handle: %d", m_handleToRemove); + LogDebug("Removing old insallation. Handle: " << m_handleToRemove); if (ACE_OK != ace_unregister_widget( static_cast(m_handleToRemove))) { - _W( + LogWarning( "Error while removing ace entry for previous insallation"); } } @@ -150,16 +153,16 @@ void TaskDatabase::StepAceDBInsert() if (!AceApi::registerAceWidget(m_handle, m_context.widgetConfig, m_context.widgetSecurity.getCertificateList())) { - _E("ace database insert failed"); + LogError("ace database insert failed"); ThrowMsg(Exceptions::UpdateFailed, "Update failure. ace_register_widget failed"); } - _D("Ace data inserted"); + LogDebug("Ace data inserted"); } void TaskDatabase::StepSecurityOriginDBInsert() { - _D("Create Security origin database"); + LogDebug("Create Security origin database"); // automatically create security origin database using namespace SecurityOriginDB; using namespace WrtDB; @@ -184,7 +187,7 @@ void TaskDatabase::StepSecurityOriginDBInsert() void TaskDatabase::StepWidgetInterfaceDBInsert() { - _D("Create Widget Interface database"); + LogDebug("Create Widget Interface database"); using namespace WidgetInterfaceDB; using namespace WrtDB; @@ -196,9 +199,9 @@ void TaskDatabase::StepWidgetInterfaceDBInsert() std::string dbPath = WidgetInterfaceDAO::databaseFileName(handle); std::string backupDbPath = dbPath; backupDbPath += GlobalConfig::GetBackupDatabaseSuffix(); - _D("\"%s\" to \"%s\"", dbPath.c_str(), backupDbPath.c_str()); + LogDebug("\"" << dbPath << "\" to \"" << backupDbPath << "\""); if (0 != std::rename(dbPath.c_str(), backupDbPath.c_str())) { - _E("widget interface database backup failed"); + LogError("widget interface database backup failed"); ThrowMsg(Exceptions::UpdateFailed, "widget interface database backup failed"); } @@ -211,7 +214,7 @@ void TaskDatabase::StepWidgetInterfaceDBInsert() } Catch(WidgetInterfaceDAO::Exception::DatabaseError) { - _E("widget interface database create failed"); + LogError("widget interface database create failed"); ThrowMsg(Exceptions::UpdateFailed, "widget interface database create failed"); } @@ -239,16 +242,16 @@ void TaskDatabase::StepRegisterExternalFiles() } Catch(WidgetDAOReadOnly::Exception::WidgetNotExist) { - _E( + LogError( "Given tizenId not found for update installation (Same GUID?)"); ThrowMsg(Exceptions::UpdateFailed, "Given tizenId not found for update installation"); } } - _D("Registering external files:"); + LogDebug("Registering external files:"); FOREACH(file, externalLocationsUpdate) { - _D(" -> %ls", (*file).c_str()); + LogDebug(" -> " << *file); } //set external locations to be registered @@ -258,32 +261,32 @@ void TaskDatabase::StepRegisterExternalFiles() void TaskDatabase::StepRemoveExternalFiles() { if (!m_externalLocationsToRemove.empty()) { - _D("Removing external files:"); + LogDebug("Removing external files:"); } FOREACH(file, m_externalLocationsToRemove) { if (WrtUtilFileExists(*file)) { - _D(" -> %ls", (*file).c_str()); + LogDebug(" -> " << *file); if (-1 == TEMP_FAILURE_RETRY(remove(file->c_str()))) { ThrowMsg(Exceptions::RemovingFileFailure, "Failed to remove external file"); } } else if (WrtUtilDirExists(*file)) { - _D(" -> %ls", (*file).c_str()); + LogDebug(" -> " << *file); if (!WrtUtilRemove(*file)) { ThrowMsg(Exceptions::RemovingFolderFailure, "Failed to remove external directory"); } } else { - _W(" -> %ls(no such a path)", (*file).c_str()); + LogWarning(" -> " << *file << "(no such a path)"); } } } void TaskDatabase::StepAbortDBInsert() { - _W("[DB Update Task] Aborting... (DB Clean)"); + LogWarning("[DB Update Task] Aborting... (DB Clean)"); Try { if (m_context.isUpdateMode) { @@ -293,17 +296,17 @@ void TaskDatabase::StepAbortDBInsert() } else { WidgetDAO::unregisterWidget(m_context.widgetConfig.tzAppid); } - _D("Cleaning DB successful!"); + LogDebug("Cleaning DB successful!"); } Catch(DPL::DB::SqlConnection::Exception::Base) { - _E("Failed to handle StepAbortDBClean!"); + LogError("Failed to handle StepAbortDBClean!"); } } void TaskDatabase::StepAbortAceDBInsert() { - _W("[DB Update Task] ACE DB Aborting... (DB Clean)"); + LogWarning("[DB Update Task] ACE DB Aborting... (DB Clean)"); ace_unregister_widget(static_cast(m_handle)); // Remove also old one. If it was already updated nothing wrong will happen, @@ -314,14 +317,14 @@ void TaskDatabase::StepAbortAceDBInsert() if (!AceApi::registerAceWidgetFromDB(m_handleToRemove)) { - _E("ace database restore failed"); + LogError("ace database restore failed"); } - _D("Ace data inserted"); + LogDebug("Ace data inserted"); } void TaskDatabase::StepAbortWidgetInterfaceDBInsert() { - _D("[DB Update Task] Widget interface Aborting..."); + LogDebug("[DB Update Task] Widget interface Aborting..."); using namespace WidgetInterfaceDB; using namespace WrtDB; @@ -331,16 +334,16 @@ void TaskDatabase::StepAbortWidgetInterfaceDBInsert() // remove database if (remove(dbPath.c_str()) != 0) { - _W("Fail to remove"); + LogWarning("Fail to remove"); } // rollback database if (m_context.isUpdateMode) { std::string backupDbPath = dbPath; backupDbPath += GlobalConfig::GetBackupDatabaseSuffix(); - _D("\"%s\" to \"%s\"", dbPath.c_str(), backupDbPath.c_str()); + LogDebug("\"" << dbPath << "\" to \"" << backupDbPath << "\""); if (0 != std::rename(backupDbPath.c_str(), dbPath.c_str())) { - _W("Fail to rollback"); + LogWarning("Fail to rollback"); } } } @@ -364,17 +367,17 @@ void TaskDatabase::StepLiveboxDBInsert() } else { boxType = DPL::ToUTF8String((**it).m_type); } - _D("livebox id: %s", boxId.c_str()); - _D("livebox type: %s", boxType.c_str()); + LogDebug("livebox id: " << boxId); + LogDebug("livebox type: " << boxType); int autoLaunch = (**it).m_autoLaunch == L"true" ? 1 : 0; - _D("livebox auto-launch: %d", autoLaunch); + LogDebug("livebox auto-launch: " << autoLaunch); int mouseEvent = (**it).m_boxInfo.m_boxMouseEvent == L"true" ? 1 : 0; - _D("livebox mouse-event: %d", mouseEvent); + LogDebug("livebox mouse-event: " << mouseEvent); int pdFastOpen = (**it).m_boxInfo.m_pdFastOpen == L"true" ? 1 : 0; - _D("livebox pd fast-open: %d", pdFastOpen); + LogDebug("livebox pd fast-open: " << pdFastOpen); web_provider_livebox_insert_box_info( boxId.c_str(), tizenId.c_str(), boxType.c_str(), @@ -384,12 +387,12 @@ void TaskDatabase::StepLiveboxDBInsert() void TaskDatabase::StartStep() { - _D("--------- : START ----------"); + LogDebug("--------- : START ----------"); } void TaskDatabase::EndStep() { - _D("--------- : END ----------"); + LogDebug("--------- : END ----------"); } } //namespace WidgetInstall } //namespace Jobs diff --git a/src/jobs/widget_install/task_encrypt_resource.cpp b/src/jobs/widget_install/task_encrypt_resource.cpp index d032fcd..7e3b18a 100644 --- a/src/jobs/widget_install/task_encrypt_resource.cpp +++ b/src/jobs/widget_install/task_encrypt_resource.cpp @@ -34,6 +34,7 @@ #include +#include #include #include #include @@ -45,8 +46,6 @@ #include #include -#include - using namespace WrtDB; namespace { @@ -189,7 +188,7 @@ TaskEncryptResource::TaskEncryptResource(InstallerContext& context) : void TaskEncryptResource::StepEncryptResource() { - _D("Step Encrypt resource"); + LogDebug("Step Encrypt resource"); EncryptDirectory(m_context.locations->getTemporaryRootDir()); } @@ -203,7 +202,8 @@ void TaskEncryptResource::EncryptDirectory(std::string path) if ((fts = fts_open(paths, FTS_PHYSICAL | FTS_NOCHDIR, NULL)) == NULL) { //ERROR int error = errno; - _W("%s: fts_open failed with error: %s", __PRETTY_FUNCTION__, strerror(error)); + LogWarning(__PRETTY_FUNCTION__ << ": fts_open failed with error: " + << strerror(error)); ThrowMsg(Exceptions::EncryptionFailed, "Error reading directory: " << path); } @@ -230,7 +230,11 @@ void TaskEncryptResource::EncryptDirectory(std::string path) case FTS_DNR: case FTS_ERR: default: - _W("%s: traversal failed on file: %s with error: %s", __PRETTY_FUNCTION__, ftsent->fts_path, strerror(ftsent->fts_errno)); + LogWarning(__PRETTY_FUNCTION__ + << ": traversal failed on file: " + << ftsent->fts_path + << " with error: " + << strerror(ftsent->fts_errno)); ThrowMsg(Exceptions::EncryptionFailed, "Error reading file"); break; } @@ -238,13 +242,14 @@ void TaskEncryptResource::EncryptDirectory(std::string path) if (fts_close(fts) == -1) { int error = errno; - _W("%s: fts_close failed with error: %s", __PRETTY_FUNCTION__, strerror(error)); + LogWarning(__PRETTY_FUNCTION__ << ": fts_close failed with error: " + << strerror(error)); } } void TaskEncryptResource::EncryptFile(const std::string &fileName) { - _D("Encrypt file: %s", fileName.c_str()); + LogDebug("Encrypt file: " << fileName); std::string encFile = fileName + ".enc"; struct stat info; @@ -258,7 +263,7 @@ void TaskEncryptResource::EncryptFile(const std::string &fileName) } const std::size_t fileSize = info.st_size; if (0 == fileSize) { - _D("%s size is 0, so encryption is skiped", fileName.c_str()); + LogDebug(fileName << " size is 0, so encryption is skiped"); return; } @@ -306,14 +311,14 @@ void TaskEncryptResource::EncryptFile(const std::string &fileName) outFile.Reset(); inFile.Reset(); - _D("File encrypted successfully"); - _D("Remove plain-text file: %s", fileName.c_str()); + LogDebug("File encrypted successfully"); + LogDebug("Remove plain-text file: " << fileName); if (0 != unlink(fileName.c_str())) { Throw(Exceptions::EncryptionFailed); } - _D("Rename encrypted file"); + LogDebug("Rename encrypted file"); if (0 != std::rename(encFile.c_str(), fileName.c_str())) { Throw(Exceptions::EncryptionFailed); @@ -334,7 +339,7 @@ void TaskEncryptResource::EncryptFile(const std::string &fileName) void TaskEncryptResource::StartStep() { - _D("--------- : START ----------"); + LogDebug("--------- : START ----------"); } void TaskEncryptResource::EndStep() @@ -343,7 +348,7 @@ void TaskEncryptResource::EndStep() InstallerContext::INSTALL_ECRYPTION_FILES, "Ecrypt resource files"); - _D("--------- : END ----------"); + LogDebug("--------- : END ----------"); } } //namespace WidgetInstall } //namespace Jobs diff --git a/src/jobs/widget_install/task_file_manipulation.cpp b/src/jobs/widget_install/task_file_manipulation.cpp index a9dff14..a06dcf6 100644 --- a/src/jobs/widget_install/task_file_manipulation.cpp +++ b/src/jobs/widget_install/task_file_manipulation.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -36,7 +37,6 @@ #include #include #include -#include #define WEBAPP_DEFAULT_UID 5000 #define WEBAPP_DEFAULT_GID 5000 @@ -102,7 +102,7 @@ bool _FolderCopy(std::string source, std::string dest) void changeOwnerForDirectory(std::string storagePath, mode_t mode) { if (euidaccess(storagePath.c_str(), F_OK) != 0) { if (!WrtUtilMakeDir(storagePath, mode)) { - _E("Failed to create directory : %s", storagePath.c_str()); + LogError("Failed to create directory : " << storagePath); ThrowMsg(Jobs::WidgetInstall::Exceptions::FileOperationFailed, "Failed to create directory : " << storagePath); } @@ -118,7 +118,7 @@ void changeOwnerForDirectory(std::string storagePath, mode_t mode) { "Chown to invaild user"); } } else if (euidaccess(storagePath.c_str(), W_OK | R_OK | X_OK) == 0) { - _D("%s already exists.", storagePath.c_str()); + LogDebug(storagePath << " already exists."); // Even if private directory already is created, private dircetory // should change owner. if (chown(storagePath.c_str(), @@ -185,9 +185,9 @@ void TaskFileManipulation::StepCreateDirs() // If package type is widget with osp service, we don't need to make bin // and src directory if (m_context.widgetConfig.packagingType == PKG_TYPE_HYBRID_WEB_APP) { - _D("Doesn't need to create resource directory"); + LogDebug("Doesn't need to create resource directory"); } else { - _D("Create resource directory"); + LogDebug("Create resource directory"); WrtUtilMakeDir(widgetBinPath); WrtUtilMakeDir(widgetSrcPath); if (m_context.mode.installTime == InstallMode::InstallTime::PRELOAD) { @@ -204,22 +204,23 @@ void TaskFileManipulation::StepCreateDirs() void TaskFileManipulation::StepCreatePrivateStorageDir() { std::string storagePath = m_context.locations->getPrivateStorageDir(); - _D("Create private storage directory : %s", m_context.locations->getPrivateStorageDir().c_str()); + LogDebug("Create private storage directory : " << + m_context.locations->getPrivateStorageDir()); changeOwnerForDirectory(storagePath, PRIVATE_STORAGE_MODE); if (m_context.isUpdateMode) { //update std::string backData = m_context.locations->getBackupPrivateDir(); - _D("copy private storage %s to %s", backData.c_str(), storagePath.c_str()); + LogDebug("copy private storage " << backData << " to " << storagePath); if (!DirectoryApi::DirectoryCopy(backData, storagePath)) { - _E("Failed to rename %s to %s", backData.c_str(), storagePath.c_str()); + LogError("Failed to rename " << backData << " to " << storagePath); ThrowMsg(Exceptions::BackupFailed, "Error occurs copy private strage files"); } } std::string tempStoragePath = m_context.locations->getPrivateTempStorageDir(); - _D("Create temp private storage directory : %s", tempStoragePath.c_str()); + LogDebug("Create temp private storage directory : " << tempStoragePath); changeOwnerForDirectory(tempStoragePath, PRIVATE_STORAGE_MODE); } @@ -233,7 +234,7 @@ void TaskFileManipulation::StepRenamePath() instDir = m_context.locations->getSourceDir(); } - _D("Copy file from temp directory to %s", instDir.c_str()); + LogDebug("Copy file from temp directory to " << instDir); if (!WrtUtilRemove(instDir)) { ThrowMsg(Exceptions::RemovingFolderFailure, "Error occurs during removing existing folder"); @@ -259,13 +260,15 @@ void TaskFileManipulation::StepLinkForPreload() WrtDB::GlobalConfig::GetWidgetResPath(); if (0 != access(optRes.c_str(), F_OK)) { - _D("Make symbolic name for preload app %s to %s", usrRes.c_str(), optRes.c_str()); + LogDebug("Make symbolic name for preload app" << + usrRes << " to " << optRes); if (symlink(usrRes.c_str(), optRes.c_str()) != 0) { int error = errno; if (error) - _E("Failed to make a symbolic name for a file [%s]", (DPL::GetErrnoString(error)).c_str()); + LogPedantic("Failed to make a symbolic name for a file " + << "[" << DPL::GetErrnoString(error) << "]"); ThrowMsg(Exceptions::FileOperationFailed, "Symbolic link creating is not done."); } @@ -276,13 +279,15 @@ void TaskFileManipulation::StepLinkForPreload() std::string dataDir = m_context.locations->getPackageInstallationDir() + "/" + WrtDB::GlobalConfig::GetWidgetPrivateStoragePath(); if (0 != access(dataDir.c_str(), F_OK)) { - _D("Make symbolic name for preload app %s to %s", storagePath.c_str(), dataDir.c_str()); + LogDebug("Make symbolic name for preload app " << + storagePath << " to " << dataDir); if (symlink(storagePath.c_str(), dataDir.c_str()) != 0) { int error = errno; if (error) - _E("Failed to make a symbolic name for a file [%s]", (DPL::GetErrnoString(error)).c_str()); + LogPedantic("Failed to make a symbolic name for a file " + << "[" << DPL::GetErrnoString(error) << "]"); ThrowMsg(Exceptions::FileOperationFailed, "Symbolic link creating is not done."); } @@ -292,12 +297,14 @@ void TaskFileManipulation::StepLinkForPreload() if (m_context.widgetConfig.packagingType != PKG_TYPE_HYBRID_WEB_APP) { std::string widgetBinPath = m_context.locations->getBinaryDir(); std::string userBinPath = m_context.locations->getUserBinaryDir(); - _D("Make symbolic link for preload app %s to %s", widgetBinPath.c_str(), userBinPath.c_str()); + LogDebug("Make symbolic link for preload app " << widgetBinPath << + " to " << userBinPath); if (symlink(widgetBinPath.c_str(), userBinPath.c_str()) != 0) { int error = errno; if (error) - _E("Failed to make a symbolic name for a file [%s]", (DPL::GetErrnoString(error)).c_str()); + LogPedantic("Failed to make a symbolic name for a file " + << "[" << DPL::GetErrnoString(error) << "]"); ThrowMsg(Exceptions::FileOperationFailed, "Symbolic link creating is not done."); } @@ -308,26 +315,26 @@ void TaskFileManipulation::StepLinkForPreload() void TaskFileManipulation::StepAbortRenamePath() { - _D("[Rename Widget Path] Aborting.... (Rename path)"); + LogDebug("[Rename Widget Path] Aborting.... (Rename path)"); std::string widgetPath; widgetPath = m_context.locations->getPackageInstallationDir(); if (!WrtUtilRemove(widgetPath)) { - _E("Error occurs during removing existing folder"); + LogError("Error occurs during removing existing folder"); } // Remove user data directory if preload web app. std::string userData = m_context.locations->getUserDataRootDir(); if (0 == access(userData.c_str(), F_OK)) { if (!WrtUtilRemove(userData)) { - _E("Error occurs during removing user data directory"); + LogError("Error occurs during removing user data directory"); } } - _D("Rename widget path sucessful!"); + LogDebug("Rename widget path sucessful!"); } void TaskFileManipulation::StepPrepareExternalDir() { - _D("Step prepare to install in exernal directory"); + LogDebug("Step prepare to install in exernal directory"); Try { std::string pkgid = DPL::ToUTF8String(m_context.widgetConfig.tzPkgid); @@ -377,14 +384,15 @@ void TaskFileManipulation::StepPrepareExternalDir() void TaskFileManipulation::StepInstallToExternal() { - _D("StepInstallExternal"); + LogDebug("StepInstallExternal"); if (!WrtUtilMakeDir(m_context.locations->getSourceDir())) { ThrowMsg(Exceptions::ErrorExternalInstallingFailure, "To make src \ directory failed"); } - _D("Resource move to external storage %s", m_context.locations->getSourceDir().c_str()); + LogDebug("Resource move to external storage " << + m_context.locations->getSourceDir()); if (!_FolderCopy(m_context.locations->getTemporaryPackageDir(), m_context.locations->getSourceDir())) { @@ -395,7 +403,7 @@ void TaskFileManipulation::StepInstallToExternal() void TaskFileManipulation::StepAbortCreateExternalDir() { - _E("Abort StepAbortCreateExternalDir"); + LogError("Abort StepAbortCreateExternalDir"); if (m_context.isUpdateMode) { WidgetInstallToExtSingleton::Instance().postUpgrade(false); } else { @@ -406,9 +414,10 @@ void TaskFileManipulation::StepAbortCreateExternalDir() void TaskFileManipulation::StepCreateSharedFolder() { - _D("StepCreateSharedFolder"); + LogDebug("StepCreateSharedFolder"); std::string sharedPath = m_context.locations->getSharedRootDir(); - _D("Create shared directory : %s", m_context.locations->getSharedRootDir().c_str()); + LogDebug("Create shared directory : " << + m_context.locations->getSharedRootDir()); WrtUtilMakeDir(sharedPath); WrtUtilMakeDir(m_context.locations->getSharedResourceDir()); @@ -427,21 +436,27 @@ void TaskFileManipulation::StepCreateSharedFolder() && m_context.mode.installTime == InstallMode::InstallTime::PRELOAD)) { /* Restore /shared/data */ - _D("copy %s to %s", m_context.locations->getBackupSharedDataDir().c_str(), m_context.locations->getSharedDataDir().c_str()); + LogDebug("copy " << m_context.locations->getBackupSharedDataDir() << + " to " << m_context.locations->getSharedDataDir()); if (!DirectoryApi::DirectoryCopy( m_context.locations->getBackupSharedDataDir(), m_context.locations->getSharedDataDir())) { - _E("Failed to rename %s to %s", m_context.locations->getBackupSharedDataDir().c_str(), m_context.locations->getSharedDataDir().c_str()); + LogError("Failed to rename " << + m_context.locations->getBackupSharedDataDir() << + " to " << m_context.locations->getSharedDataDir()); ThrowMsg(Exceptions::BackupFailed, "Error occurs copy shared strage files"); } /* Restore /shared/trusted */ - _D("copy %s to %s", m_context.locations->getBackupSharedTrustedDir().c_str(), m_context.locations->getSharedTrustedDir().c_str()); + LogDebug("copy " << m_context.locations->getBackupSharedTrustedDir() << + " to " << m_context.locations->getSharedTrustedDir()); if (!DirectoryApi::DirectoryCopy( m_context.locations->getBackupSharedTrustedDir(), m_context.locations->getSharedTrustedDir())) { - _E("Failed to rename %s to %s", m_context.locations->getBackupSharedTrustedDir().c_str(), m_context.locations->getSharedTrustedDir().c_str()); + LogError("Failed to rename " << + m_context.locations->getBackupSharedTrustedDir() << " to " << + m_context.locations->getSharedTrustedDir()); ThrowMsg(Exceptions::BackupFailed, "Error occurs copy shared strage files"); } @@ -450,12 +465,12 @@ void TaskFileManipulation::StepCreateSharedFolder() void TaskFileManipulation::StartStep() { - _D("--------- : START ----------"); + LogDebug("--------- : START ----------"); } void TaskFileManipulation::EndStep() { - _D("--------- : END ----------"); + LogDebug("--------- : END ----------"); } } //namespace WidgetInstall } //namespace Jobs diff --git a/src/jobs/widget_install/task_install_ospsvc.cpp b/src/jobs/widget_install/task_install_ospsvc.cpp index 96d0dae..0a3e2f6 100644 --- a/src/jobs/widget_install/task_install_ospsvc.cpp +++ b/src/jobs/widget_install/task_install_ospsvc.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -36,8 +37,6 @@ #include #include -#include - using namespace WrtDB; namespace { @@ -58,19 +57,19 @@ TaskInstallOspsvc::TaskInstallOspsvc(InstallerContext& context) : void TaskInstallOspsvc::StepInstallOspService() { - _D("Step: installation for osp service"); + LogDebug("Step: installation for osp service"); std::ostringstream commStr; commStr << OSP_INSTALL_STR << BashUtils::escape_arg( m_context.locations->getPackageInstallationDir()); //commStr << " 2>&1"; - _D("osp install command : %s", commStr.str().c_str()); + LogDebug("osp install command : " << commStr.str()); char readBuf[MAX_BUF_SIZE]; FILE *fd; fd = popen(commStr.str().c_str(), "r"); if (NULL == fd) { - _E("Failed to installtion osp service"); + LogError("Failed to installtion osp service"); ThrowMsg(Exceptions::InstallOspsvcFailed, "Error occurs during\ install osp service"); @@ -78,13 +77,13 @@ void TaskInstallOspsvc::StepInstallOspService() if (fgets(readBuf, MAX_BUF_SIZE, fd) == NULL) { - _E("Failed to installtion osp service.\ + LogError("Failed to installtion osp service.\ Inability of reading file."); ThrowMsg(Exceptions::InstallOspsvcFailed, "Error occurs during\ install osp service"); } - _D("return value : %s", readBuf); + LogDebug("return value : " << readBuf); int result = atoi(readBuf); if (0 != result) { @@ -98,7 +97,7 @@ void TaskInstallOspsvc::StepInstallOspService() void TaskInstallOspsvc::StartStep() { - _D("--------- : START ----------"); + LogDebug("--------- : START ----------"); } void TaskInstallOspsvc::EndStep() @@ -107,7 +106,7 @@ void TaskInstallOspsvc::EndStep() InstallerContext::INSTALL_INSTALL_OSPSVC, "Installed Osp servcie"); - _D("--------- : END ----------"); + LogDebug("--------- : END ----------"); } } //namespace WidgetInstall } //namespace Jobs diff --git a/src/jobs/widget_install/task_manifest_file.cpp b/src/jobs/widget_install/task_manifest_file.cpp index f756c03..d907b4b 100644 --- a/src/jobs/widget_install/task_manifest_file.cpp +++ b/src/jobs/widget_install/task_manifest_file.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -53,8 +54,6 @@ #include #include -#include - #define DEFAULT_ICON_NAME "icon.png" #define DEFAULT_PREVIEW_NAME "preview.png" @@ -85,7 +84,7 @@ DPL::OptionalString getLangTag(const DPL::String& tag) DPL::String langTag = tag; - _D("Trying to map language tag: %ls", langTag.c_str()); + LogDebug("Trying to map language tag: " << langTag); size_t pos = langTag.find_first_of(L'_'); if (pos != DPL::String::npos) { langTag.erase(pos); @@ -95,8 +94,9 @@ DPL::OptionalString getLangTag(const DPL::String& tag) LanguageTagMap::iterator it = TagsMap.find(langTag); if (it != TagsMap.end()) { ret = it->second; - _D("Mapping IANA Language tag to language tag: %ls -> %ls", langTag.c_str(), (*ret).c_str()); } + LogDebug("Mapping IANA Language tag to language tag: " << + langTag << " -> " << ret); return ret; } @@ -148,7 +148,8 @@ void TaskManifestFile::stepCreateExecFile() { int error = errno; if (error) - _E("Failed to make a symbolic name for a file [%s]", DPL::GetErrnoString(error).c_str()); + LogPedantic("Failed to make a symbolic name for a file " + << "[" << DPL::GetErrnoString(error) << "]"); } // app-control widgets @@ -168,19 +169,21 @@ void TaskManifestFile::stepCreateExecFile() if (symlink(clientExeStr.c_str(), controlExec.c_str()) != 0) { int error = errno; if (error) { - _E("Failed to make a symbolic name for a file [%s]", DPL::GetErrnoString(error).c_str()); + LogPedantic("Failed to make a symbolic name for a file " + << "[" << DPL::GetErrnoString(error) << "]"); } } } #else //default widget - _D("link -s %s %s", clientExeStr.c_str(), exec.c_str()); + LogDebug("link -s " << clientExeStr << " " << exec); errno = 0; if (symlink(clientExeStr.c_str(), exec.c_str()) != 0) { int error = errno; if (error) - _E("Failed to make a symbolic name for a file [%s]", DPL::GetErrnoString(error).c_str()); + LogPedantic("Failed to make a symbolic name for a file " + << "[" << DPL::GetErrnoString(error) << "]"); } #endif @@ -194,7 +197,8 @@ void TaskManifestFile::stepCreateExecFile() if (symlink(boxExec.c_str(), boxSymlink.c_str()) != 0) { if (errno) { - _E("Failed to make a symbolic name for a file [%s]", DPL::GetErrnoString(errno).c_str()); + LogPedantic("Failed to make a symbolic name for a file " + << "[" << DPL::GetErrnoString(errno) << "]"); } } } @@ -206,7 +210,7 @@ void TaskManifestFile::stepCreateExecFile() void TaskManifestFile::stepCopyIconFiles() { - _D("CopyIconFiles"); + LogDebug("CopyIconFiles"); //This function copies icon to desktop icon path. For each locale avaliable //which there is at least one icon in widget for, icon file is copied. @@ -228,12 +232,12 @@ void TaskManifestFile::stepCopyIconFiles() DPL::String src = icon->src; FOREACH(locale, icon->availableLocales) { - _D("Icon for locale: %ls is: %ls", (*locale).c_str(), src.c_str()); + LogDebug("Icon for locale: " << *locale << "is: " << src); if (std::find(generatedLocales.begin(), generatedLocales.end(), *locale) != generatedLocales.end()) { - _D("Skipping - has that locale"); + LogDebug("Skipping - has that locale"); continue; } else { generatedLocales.push_back(*locale); @@ -256,7 +260,7 @@ void TaskManifestFile::stepCopyIconFiles() targetFile.Fullpath()); } - _D("Copying icon: %s -> %s", sourceFile.Filename().c_str(), targetFile.Filename().c_str()); + LogDebug("Copying icon: " << sourceFile << " -> " << targetFile); icon_list.push_back(targetFile.Fullpath()); @@ -272,7 +276,7 @@ void TaskManifestFile::stepCopyIconFiles() // Error while opening or closing source file //ReThrowMsg(InstallerException::CopyIconFailed, // sourceFile.str()); - _E( + LogError( "Copying widget's icon failed. Widget's icon will not be" \ "available from Main Screen"); } @@ -282,7 +286,7 @@ void TaskManifestFile::stepCopyIconFiles() // Error while opening or closing target file //ReThrowMsg(InstallerException::CopyIconFailed, // targetFile.str()); - _E( + LogError( "Copying widget's icon failed. Widget's icon will not be" \ "available from Main Screen"); } @@ -292,7 +296,7 @@ void TaskManifestFile::stepCopyIconFiles() // Error while copying //ReThrowMsg(InstallerException::CopyIconFailed, // targetFile.str()); - _E( + LogError( "Copying widget's icon failed. Widget's icon will not be" \ "available from Main Screen"); } @@ -306,7 +310,7 @@ void TaskManifestFile::stepCopyIconFiles() void TaskManifestFile::stepCopyLiveboxFiles() { - _D("Copy Livebox Files"); + LogDebug("Copy Livebox Files"); using namespace WrtDB; ConfigParserData &data = m_context.widgetConfig.configInfo; @@ -371,7 +375,8 @@ void TaskManifestFile::copyDynamicBoxFile(const std::string& sourceFile, } Catch(DPL::Exception) { - _E("Copying Dynamic Box File Failed. %s to %s", sourceFile.c_str(), targetFile.c_str()); + LogError("Copying Dynamic Box File Failed. " << sourceFile + << " to " << targetFile); ReThrowMsg(Exceptions::DynamicBoxFailed, "Dynamic Box File Copy Failed."); } } @@ -385,7 +390,7 @@ bool TaskManifestFile::addBoxUiApplication(Manifest& manifest) Try { if (isAdded) { - _D("UiApplication for d-box is already added"); + LogDebug("UiApplication for d-box is already added"); return false; } uiApp.setNodisplay(true); @@ -405,7 +410,7 @@ bool TaskManifestFile::addBoxUiApplication(Manifest& manifest) } Catch(DPL::Exception) { - _E("Adding UiApplication on xml is failed."); + LogError("Adding UiApplication on xml is failed."); isAdded = false; return false; } @@ -413,7 +418,7 @@ bool TaskManifestFile::addBoxUiApplication(Manifest& manifest) void TaskManifestFile::stepBackupIconFiles() { - _D("Backup Icon Files"); + LogDebug("Backup Icon Files"); backup_dir << m_context.locations->getBackupDir() << "/"; @@ -426,10 +431,10 @@ void TaskManifestFile::stepBackupIconFiles() void TaskManifestFile::stepAbortIconFiles() { - _D("Abrot Icon Files"); + LogDebug("Abrot Icon Files"); FOREACH(it, icon_list) { - _D("Remove Update Icon : %ls", (*it).c_str()); + LogDebug("Remove Update Icon : " << (*it)); unlink((*it).c_str()); } @@ -456,16 +461,19 @@ void TaskManifestFile::stepAbortIconFiles() } Catch(DPL::FileInput::Exception::Base) { - _E("Restoration icon File Failed. %s to %s", backup_file.str().c_str(), res_file.str().c_str()); + LogError("Restoration icon File Failed." << backup_file.str() + << " to " << res_file.str()); } Catch(DPL::FileOutput::Exception::Base) { - _E("Restoration icon File Failed. %s to %s", backup_file.str().c_str(), res_file.str().c_str()); + LogError("Restoration icon File Failed." << backup_file.str() + << " to " << res_file.str()); } Catch(DPL::CopyFailed) { - _E("Restoration icon File Failed. %s to %s", backup_file.str().c_str(), res_file.str().c_str()); + LogError("Restoration icon File Failed." << backup_file.str() + << " to " << res_file.str()); } } } @@ -517,12 +525,12 @@ void TaskManifestFile::saveLocalizedKey(std::ofstream &file, void TaskManifestFile::backupIconFiles() { - _D("Backup Icon Files"); + LogDebug("Backup Icon Files"); std::ostringstream b_icon_dir; b_icon_dir << backup_dir.str() << "icons"; - _D("Create icon backup folder : %s", b_icon_dir.str().c_str()); + LogDebug("Create icon backup folder : " << b_icon_dir.str()); WrtUtilMakeDir(b_icon_dir.str()); std::list fileList; @@ -540,7 +548,8 @@ void TaskManifestFile::backupIconFiles() backup_icon << b_icon_dir.str() << "/" << (*it); - _D("Backup icon file %s to %s", icon_file.str().c_str(), backup_icon.str().c_str()); + LogDebug("Backup icon file " << icon_file.str() << " to " << + backup_icon.str()); Try { DPL::FileInput input(icon_file.str()); @@ -549,18 +558,18 @@ void TaskManifestFile::backupIconFiles() } Catch(DPL::FileInput::Exception::Base) { - _E("Backup Desktop File Failed."); + LogError("Backup Desktop File Failed."); ReThrowMsg(Exceptions::BackupFailed, icon_file.str()); } Catch(DPL::FileOutput::Exception::Base) { - _E("Backup Desktop File Failed."); + LogError("Backup Desktop File Failed."); ReThrowMsg(Exceptions::BackupFailed, backup_icon.str()); } Catch(DPL::CopyFailed) { - _E("Backup Desktop File Failed."); + LogError("Backup Desktop File Failed."); ReThrowMsg(Exceptions::BackupFailed, backup_icon.str()); } unlink((*it).c_str()); @@ -573,7 +582,7 @@ void TaskManifestFile::getFileList(const char* path, { DIR* dir = opendir(path); if (!dir) { - _E("icon directory doesn't exist"); + LogError("icon directory doesn't exist"); ThrowMsg(Exceptions::FileOperationFailed, path); } @@ -595,11 +604,12 @@ void TaskManifestFile::getFileList(const char* path, } if (return_code != 0 || errno != 0) { - _E("readdir_r() failed with %s", DPL::GetErrnoString().c_str()); + LogError("readdir_r() failed with " << DPL::GetErrnoString()); } if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) { - _E("Failed to close dir: %s with error: %s", path, DPL::GetErrnoString().c_str()); + LogError("Failed to close dir: " << path << " with error: " + << DPL::GetErrnoString()); } } @@ -623,7 +633,7 @@ void TaskManifestFile::stepGenerateManifest() destFile << DPL::ToUTF8String(manifest_name); commit_manifest = destFile.str(); - _D("Commiting manifest file : %s", commit_manifest.c_str()); + LogDebug("Commiting manifest file : " << commit_manifest); commitManifest(); @@ -638,12 +648,12 @@ void TaskManifestFile::commitManifest() if (!(m_context.mode.rootPath == InstallMode::RootPath::RO && m_context.mode.installTime == InstallMode::InstallTime::PRELOAD && m_context.mode.extension == InstallMode::ExtensionType::DIR)) { - _D("cp %s %s", manifest_file.c_str(), commit_manifest.c_str()); + LogDebug("cp " << manifest_file << " " << commit_manifest); DPL::FileInput input(DPL::ToUTF8String(manifest_file)); DPL::FileOutput output(commit_manifest); DPL::Copy(&input, &output); - _D("Manifest writen to: %s", commit_manifest.c_str()); + LogDebug("Manifest writen to: " << commit_manifest); //removing temp file unlink((DPL::ToUTF8String(manifest_file)).c_str()); @@ -653,7 +663,7 @@ void TaskManifestFile::commitManifest() void TaskManifestFile::writeManifest(const DPL::String & path) { - _D("Generating manifest file : %ls", path.c_str()); + LogDebug("Generating manifest file : " << path); Manifest manifest; UiApplication uiApp; @@ -719,7 +729,7 @@ void TaskManifestFile::writeManifest(const DPL::String & path) #endif manifest.generate(path); - _D("Manifest file serialized"); + LogDebug("Manifest file serialized"); } void TaskManifestFile::setWidgetExecPath(UiApplication & uiApp, @@ -729,7 +739,7 @@ void TaskManifestFile::setWidgetExecPath(UiApplication & uiApp, if (!postfix.empty()) { exec.append(postfix); } - _D("exec = %s", exec.c_str()); + LogDebug("exec = " << exec); uiApp.setExec(DPL::FromASCIIString(exec)); } @@ -844,7 +854,7 @@ void TaskManifestFile::setWidgetIcons(UiApplication & uiApp) if (std::find(generatedLocales.begin(), generatedLocales.end(), *locale) != generatedLocales.end()) { - _D("Skipping - has that locale - already in manifest"); + LogDebug("Skipping - has that locale - already in manifest"); continue; } else { generatedLocales.push_back(*locale); @@ -977,7 +987,7 @@ void TaskManifestFile::setAppControlsInfo(UiApplication & uiApp) m_context.widgetConfig.configInfo.appControlList; if (appControlList.empty()) { - _D("Widget doesn't contain app control"); + LogDebug("Widget doesn't contain app control"); return; } @@ -1014,7 +1024,7 @@ void TaskManifestFile::setAppCategory(UiApplication &uiApp) m_context.widgetConfig.configInfo.categoryList; if (categoryList.empty()) { - _D("Widget doesn't contain application category"); + LogDebug("Widget doesn't contain application category"); return; } FOREACH(it, categoryList) { @@ -1030,7 +1040,7 @@ void TaskManifestFile::setMetadata(UiApplication &uiApp) m_context.widgetConfig.configInfo.metadataList; if (metadataList.empty()) { - _D("Web application doesn't contain metadata"); + LogDebug("Web application doesn't contain metadata"); return; } FOREACH(it, metadataList) { @@ -1045,17 +1055,17 @@ void TaskManifestFile::setLiveBoxInfo(Manifest& manifest) m_context.widgetConfig.configInfo.m_livebox; if (liveboxList.empty()) { - _D("no livebox"); + LogDebug("no livebox"); return; } if (!addBoxUiApplication(manifest)) { - _D("error during adding UiApplication for d-box"); + LogDebug("error during adding UiApplication for d-box"); return; } FOREACH(it, liveboxList) { - _D("setLiveBoxInfo"); + LogDebug("setLiveBoxInfo"); LiveBoxInfo liveBox; DPL::Optional ConfigInfo = *it; DPL::String appid = m_context.widgetConfig.tzAppid; @@ -1117,7 +1127,7 @@ void TaskManifestFile::setLiveBoxInfo(Manifest& manifest) if (ConfigInfo->m_boxInfo.m_boxSrc.empty() || ConfigInfo->m_boxInfo.m_boxSize.empty()) { - _D("Widget doesn't contain box"); + LogDebug("Widget doesn't contain box"); return; } else { BoxInfoType box; @@ -1200,7 +1210,7 @@ void TaskManifestFile::setAccount(Manifest& manifest) AccountProviderType provider; if (account.m_iconSet.empty()) { - _D("Widget doesn't contain Account"); + LogDebug("Widget doesn't contain Account"); return; } if (account.m_multiAccountSupport) { diff --git a/src/jobs/widget_install/task_pkg_info_update.cpp b/src/jobs/widget_install/task_pkg_info_update.cpp index 11b7b69..05be902 100644 --- a/src/jobs/widget_install/task_pkg_info_update.cpp +++ b/src/jobs/widget_install/task_pkg_info_update.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -39,8 +40,6 @@ #include #include -#include - using namespace WrtDB; namespace { @@ -83,7 +82,7 @@ void TaskPkgInfoUpdate::StepPkgInfo() m_manifest += "/opt/share/packages/"; } m_manifest += DPL::ToUTF8String(m_context.widgetConfig.tzPkgid) + ".xml"; - _D("manifest file : %s", m_manifest.c_str()); + LogDebug("manifest file : " << m_manifest); if (m_context.isUpdateMode || ( m_context.mode.rootPath == InstallMode::RootPath::RO @@ -94,7 +93,7 @@ void TaskPkgInfoUpdate::StepPkgInfo() m_manifest.c_str(), (updateTags[0] == NULL) ? NULL : updateTags); if (code != 0) { - _E("Manifest parser error: %d", code); + LogError("Manifest parser error: " << code); ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code); } } else { @@ -102,7 +101,7 @@ void TaskPkgInfoUpdate::StepPkgInfo() m_manifest.c_str(), (updateTags[0] == NULL) ? NULL : updateTags); if (code != 0) { - _E("Manifest parser error: %d", code); + LogError("Manifest parser error: " << code); ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code); } } @@ -110,15 +109,15 @@ void TaskPkgInfoUpdate::StepPkgInfo() m_context.job->UpdateProgress( InstallerContext::INSTALL_PKGINFO_UPDATE, "Manifest Update Finished"); - _D("Manifest parsed"); + LogDebug("Manifest parsed"); } void TaskPkgInfoUpdate::StepSetCertiInfo() { - _D("StepSetCertiInfo"); + LogDebug("StepSetCertiInfo"); if (pkgmgr_installer_create_certinfo_set_handle(&m_pkgHandle) < 0) { - _E("pkgmgrInstallerCreateCertinfoSetHandle fail"); + LogError("pkgmgrInstallerCreateCertinfoSetHandle fail"); ThrowMsg(Exceptions::SetCertificateInfoFailed, "Failed to create certificate handle"); } @@ -131,39 +130,39 @@ void TaskPkgInfoUpdate::StepSetCertiInfo() m_context.widgetConfig.tzPkgid).c_str()), m_pkgHandle)) < 0) { - _E("pkgmgrInstallerSaveCertinfo fail"); + LogError("pkgmgrInstallerSaveCertinfo fail"); ThrowMsg(Exceptions::SetCertificateInfoFailed, "Failed to Installer Save Certinfo"); } else { - _D("Succeed to save Certinfo"); + LogDebug("Succeed to save Certinfo"); } if (pkgmgr_installer_destroy_certinfo_set_handle(m_pkgHandle) < 0) { - _E("pkgmgrInstallerDestroyCertinfoSetHandle fail"); + LogError("pkgmgrInstallerDestroyCertinfoSetHandle fail"); } } void TaskPkgInfoUpdate::SetCertiInfo(int source) { - _D("Set CertiInfo to pkgmgr : %d", source); + LogDebug("Set CertiInfo to pkgmgr : " << source); CertificateChainList certificateChainList; m_context.widgetSecurity.getCertificateChainList(certificateChainList, (CertificateSource)source); FOREACH(it, certificateChainList) { - _D("Insert certinfo to pkgmgr structure"); + LogDebug("Insert certinfo to pkgmgr structure"); ValidationCore::CertificateCollection chain; if (false == chain.load(*it)) { - _E("Chain is broken"); + LogError("Chain is broken"); ThrowMsg(Exceptions::SetCertificateInfoFailed, "Failed to Installer Save Certinfo"); } if (!chain.sort()) { - _E("Chain failed at sorting"); + LogError("Chain failed at sorting"); } ValidationCore::CertificateList list = chain.getCertificateList(); @@ -184,7 +183,7 @@ void TaskPkgInfoUpdate::SetCertiInfo(int source) } if (distributor1) { - _D("Set SIGNATURE_DISTRIBUTOR"); + LogDebug("Set SIGNATURE_DISTRIBUTOR"); if ((*certIt)->isRootCert()) { instCertType = PM_SET_DISTRIBUTOR_ROOT_CERT; } else { @@ -195,19 +194,20 @@ void TaskPkgInfoUpdate::SetCertiInfo(int source) } } } else { - _D("Set SIGNATURE_DISTRIBUTOR2"); + LogDebug("Set SIGNATURE_DISTRIBUTOR2"); if ((*certIt)->isRootCert()) { instCertType = PM_SET_DISTRIBUTOR2_ROOT_CERT; } else { if ((*certIt)->isCA()) { - instCertType = PM_SET_DISTRIBUTOR2_INTERMEDIATE_CERT; + instCertType = + PM_SET_DISTRIBUTOR2_INTERMEDIATE_CERT; } else { instCertType = PM_SET_DISTRIBUTOR2_SIGNER_CERT; } } } } else { - _D("set SIGNATURE_AUTHOR"); + LogDebug("set SIGNATURE_AUTHOR"); if ((*certIt)->isRootCert()) { instCertType = PM_SET_AUTHOR_ROOT_CERT; } else { @@ -218,13 +218,13 @@ void TaskPkgInfoUpdate::SetCertiInfo(int source) } } } - _D("cert type : %d", instCertType); + LogDebug("cert type : " << instCertType); if ((pkgmgr_installer_set_cert_value( m_pkgHandle, instCertType, const_cast(((*certIt)->getBase64()).c_str()))) < 0) { - _E("pkgmgrInstallerSetCertValue fail"); + LogError("pkgmgrInstallerSetCertValue fail"); ThrowMsg(Exceptions::SetCertificateInfoFailed, "Failed to Set CertValue"); } @@ -239,13 +239,13 @@ void TaskPkgInfoUpdate::StepAbortCertiInfo() m_context.widgetConfig.tzPkgid).c_str()))) < 0) { - _E("pkgmgr_installer_delete_certinfo fail"); + LogError("pkgmgr_installer_delete_certinfo fail"); } } void TaskPkgInfoUpdate::StartStep() { - _D("--------- : START ----------"); + LogDebug("--------- : START ----------"); } void TaskPkgInfoUpdate::EndStep() @@ -254,23 +254,23 @@ void TaskPkgInfoUpdate::EndStep() InstallerContext::INSTALL_SET_CERTINFO, "Save certinfo to pkgmgr"); - _D("--------- : END ----------"); + LogDebug("--------- : END ----------"); } void TaskPkgInfoUpdate::stepAbortParseManifest() { - _E("[Parse Manifest] Abroting...."); + LogError("[Parse Manifest] Abroting...."); int code = pkgmgr_parser_parse_manifest_for_uninstallation( m_manifest.c_str(), NULL); if (0 != code) { - _W("Manifest parser error: %d", code); + LogWarning("Manifest parser error: " << code); ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code); } int ret = unlink(m_manifest.c_str()); if (0 != ret) { - _W("No manifest file found: %s", m_manifest.c_str()); + LogWarning("No manifest file found: " << m_manifest); } } diff --git a/src/jobs/widget_install/task_prepare_files.cpp b/src/jobs/widget_install/task_prepare_files.cpp index 8415514..8a43fa6 100644 --- a/src/jobs/widget_install/task_prepare_files.cpp +++ b/src/jobs/widget_install/task_prepare_files.cpp @@ -26,12 +26,12 @@ #include #include #include +#include #include #include #include #include #include -#include namespace Jobs { namespace WidgetInstall { @@ -47,7 +47,7 @@ TaskPrepareFiles::TaskPrepareFiles(InstallerContext &installerContext) : void TaskPrepareFiles::CopyFile(const std::string& source) { if (source.empty()) { - _W("No source file specified"); + LogWarning("No source file specified"); return; } @@ -59,8 +59,8 @@ void TaskPrepareFiles::CopyFile(const std::string& source) std::string target = m_installerContext.locations->getTemporaryPackageDir() + '/' + filename; - _D("source %s", source.c_str()); - _D("target %s", target.c_str()); + LogDebug("source " << source); + LogDebug("target " << target); Try { @@ -70,19 +70,19 @@ void TaskPrepareFiles::CopyFile(const std::string& source) } Catch(DPL::FileInput::Exception::Base) { - _E("File input error"); + LogError("File input error"); // Error while opening or closing source file ReThrowMsg(Exceptions::CopyIconFailed, source); } Catch(DPL::FileOutput::Exception::Base) { - _E("File output error"); + LogError("File output error"); // Error while opening or closing target file ReThrowMsg(Exceptions::CopyIconFailed, target); } Catch(DPL::CopyFailed) { - _E("File copy error"); + LogError("File copy error"); // Error while copying ReThrowMsg(Exceptions::CopyIconFailed, target); } @@ -102,10 +102,10 @@ void TaskPrepareFiles::StepCopyFiles() + 1); } - _D("Icons copy..."); + LogDebug("Icons copy..."); FOREACH(it, m_installerContext.widgetConfig.configInfo.iconsList) { std::ostringstream os; - _D("Coping: %s%ls", sourceDir.c_str(), DPL::ToUTF8String(it->src).c_str()); + LogDebug("Coping: " << sourceDir << DPL::ToUTF8String(it->src)); os << sourceDir << DPL::ToUTF8String(it->src); CopyFile(os.str()); } @@ -113,12 +113,12 @@ void TaskPrepareFiles::StepCopyFiles() void TaskPrepareFiles::StartStep() { - _D("--------- : START ----------"); + LogDebug("--------- : START ----------"); } void TaskPrepareFiles::EndStep() { - _D("--------- : END ----------"); + LogDebug("--------- : END ----------"); } } // namespace WidgetInstall } // namespace Jobs diff --git a/src/jobs/widget_install/task_prepare_reinstall.cpp b/src/jobs/widget_install/task_prepare_reinstall.cpp index 4980e4d..dd73268 100644 --- a/src/jobs/widget_install/task_prepare_reinstall.cpp +++ b/src/jobs/widget_install/task_prepare_reinstall.cpp @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -35,8 +36,6 @@ #include #include -#include - namespace Jobs { namespace WidgetInstall { namespace { @@ -66,7 +65,7 @@ std::string parseSubPath(const std::string& filePath) void createDir(const std::string& path) { if (WrtUtilMakeDir(path)) { - _D("Create directory : %s", path.c_str()); + LogDebug("Create directory : " << path); } else { ThrowMsg(Exceptions::RDSDeltaFailure, "Fail to create dir" << path); } @@ -89,7 +88,7 @@ TaskPrepareReinstall::TaskPrepareReinstall(InstallerContext& context) : void TaskPrepareReinstall::StepPrepare() { - _D("Prepare"); + LogDebug("Prepare"); m_sourcePath = m_context.locations->getTemporaryPackageDir(); m_sourcePath += "/"; @@ -99,7 +98,7 @@ void TaskPrepareReinstall::StepPrepare() void TaskPrepareReinstall::StepParseRDSDelta() { - _D("parse RDS delta"); + LogDebug("parse RDS delta"); std::string rdsDeltaPath = m_sourcePath; rdsDeltaPath += ".rds_delta"; std::ifstream delta(rdsDeltaPath); @@ -114,7 +113,7 @@ void TaskPrepareReinstall::StepParseRDSDelta() while (std::getline(delta, line) &&!delta.eof()) { FOREACH(keyIt, keyList) { if (line == *keyIt) { - _D("find key = [%s]", line.c_str()); + LogDebug("find key = [" << line << "]"); key = line; break; } @@ -124,20 +123,20 @@ void TaskPrepareReinstall::StepParseRDSDelta() } if (key == KEY_DELETE) { m_deleteFileList.push_back(line); - _D("line = [%s]", line.c_str()); + LogDebug("line = [" << line << "]"); } else if (key == KEY_ADD) { m_addFileList.push_back(line); - _D("line = [%s]", line.c_str()); + LogDebug("line = [" << line << "]"); } else if (key == KEY_MODIFY) { m_modifyFileList.push_back(line); - _D("line = [%s]", line.c_str()); + LogDebug("line = [" << line << "]"); } } } void TaskPrepareReinstall::StepVerifyRDSDelta() { - _D("verify RDS delta"); + LogDebug("verify RDS delta"); // Verify ADD file FOREACH(file, m_addFileList) { std::string addFilePath = m_sourcePath; @@ -160,7 +159,7 @@ void TaskPrepareReinstall::StepVerifyRDSDelta() existingFilePath += *file; verifyFile(existingFilePath); } - _D("Finished veify RDS Delta"); + LogDebug("Finished veify RDS Delta"); m_context.job->UpdateProgress( InstallerContext::INSTALL_RDS_DELTA_CHECK, @@ -169,7 +168,7 @@ void TaskPrepareReinstall::StepVerifyRDSDelta() void TaskPrepareReinstall::StepAddFile() { - _D("Add file"); + LogDebug("Add file"); FOREACH(file, m_addFileList) { std::string newfile = m_sourcePath; newfile += *file; @@ -197,14 +196,14 @@ void TaskPrepareReinstall::StepAddFile() ThrowMsg(Exceptions::RDSDeltaFailure, "Fail to add file " << newfile); } - _D("Add %s to %s", newfile.c_str(), destPath.c_str()); + LogDebug("Add " << newfile << " to " << destPath); } } } void TaskPrepareReinstall::StepDeleteFile() { - _D("Delete file"); + LogDebug("Delete file"); FOREACH(file, m_deleteFileList) { std::string deleteFilePath = m_installedPath; deleteFilePath += *file; @@ -212,13 +211,13 @@ void TaskPrepareReinstall::StepDeleteFile() ThrowMsg(Exceptions::RDSDeltaFailure, "Fail to DELETE file " << deleteFilePath); } - _D("Delete %s", deleteFilePath.c_str()); + LogDebug("Delete " << deleteFilePath); } } void TaskPrepareReinstall::StepModifyFile() { - _D("Modify file"); + LogDebug("Modify file"); FOREACH(file, m_modifyFileList) { std::string destPath = m_installedPath; destPath += *file; @@ -233,13 +232,13 @@ void TaskPrepareReinstall::StepModifyFile() ThrowMsg(Exceptions::RDSDeltaFailure, "Fail to move new file" << destPath); } - _D("Replace %s to %s", newfile.c_str(), destPath.c_str()); + LogDebug("Replace " << newfile << " to " << destPath); } } void TaskPrepareReinstall::StartStep() { - _D("---------- : START ----------"); + LogDebug("--------- : START ----------"); } void TaskPrepareReinstall::EndStep() @@ -248,7 +247,7 @@ void TaskPrepareReinstall::EndStep() InstallerContext::INSTALL_RDS_PREPARE, "RDS prepare finished"); - _D("---------- : END ----------"); + LogDebug("--------- : END ----------"); } } //namespace WidgetInstall diff --git a/src/jobs/widget_install/task_recovery.cpp b/src/jobs/widget_install/task_recovery.cpp index cf9d952..8922c0f 100644 --- a/src/jobs/widget_install/task_recovery.cpp +++ b/src/jobs/widget_install/task_recovery.cpp @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -38,8 +39,6 @@ #include #include -#include - using namespace WrtDB; namespace Jobs { @@ -55,7 +54,7 @@ TaskRecovery::TaskRecovery(InstallerContext& context) : void TaskRecovery::StartStep() { - _D("---------- : START ----------"); + LogDebug("--------- : START ----------"); } void TaskRecovery::EndStep() @@ -64,12 +63,12 @@ void TaskRecovery::EndStep() InstallerContext::INSTALL_CHECK_FILE, "Create information file for recovery"); - _D("---------- : END ----------"); + LogDebug("--------- : END ----------"); } void TaskRecovery::StepCreateCheckFile() { - _D("Step: create information file for recovery"); + LogDebug("Step: create information file for recovery"); size_t pos = m_context.locations->getWidgetSource().rfind("/"); std::ostringstream infoPath; @@ -88,7 +87,7 @@ void TaskRecovery::StepCreateCheckFile() m_context.installInfo = infoPath.str(); - _D("Create file : %s", m_context.installInfo.c_str()); + LogDebug("Create file : " << m_context.installInfo); } else { ThrowMsg(Exceptions::FileOperationFailed, "Fail to create file for recovery."); } diff --git a/src/jobs/widget_install/task_remove_backup.cpp b/src/jobs/widget_install/task_remove_backup.cpp index 10caf9e..e424ceb 100644 --- a/src/jobs/widget_install/task_remove_backup.cpp +++ b/src/jobs/widget_install/task_remove_backup.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -33,7 +34,6 @@ #include #include #include -#include using namespace WrtDB; @@ -59,24 +59,24 @@ void TaskRemoveBackupFiles::StepRemoveBackupFiles() backupDir << m_context.locations->getBackupDir(); if (WrtUtilRemove(backupDir.str())) { - _D("Success to remove backup files : %s", backupDir.str().c_str()); + LogDebug("Success to remove backup files : " << backupDir.str()); } else { - _E("Failed to remove backup directory : %s", backupDir.str().c_str()); + LogError("Failed to remove backup directory : " << backupDir.str()); ThrowMsg(Exceptions::RemoveBackupFailed, "Error occurs during removing existing folder"); } std::string tmp = m_context.locations->getTemporaryPackageDir(); if (WrtUtilRemove(tmp)) { - _D("Success to remove temp directory : %s", tmp.c_str()); + LogDebug("Success to remove temp directory : " << tmp); } else { - _E("Failed to remove temp directory : %s", tmp.c_str()); + LogError("Failed to remove temp directory : " << tmp); } } void TaskRemoveBackupFiles::StepDeleteBackupDB() { - _D("StepDeleteBackupDB"); + LogDebug("StepDeleteBackupDB"); std::string oldAppid = DPL::ToUTF8String(m_context.widgetConfig.tzAppid) + ".backup"; @@ -86,13 +86,13 @@ void TaskRemoveBackupFiles::StepDeleteBackupDB() } Catch(WidgetDAOReadOnly::Exception::WidgetNotExist) { - _E("Fail to delete old version db information"); + LogError("Fail to delete old version db information"); } } void TaskRemoveBackupFiles::StepDeleteBackupWidgetInterfaceDB() { - _D("StepDeleteBackupWidgetInterfaceDB"); + LogDebug("StepDeleteBackupWidgetInterfaceDB"); using namespace WidgetInterfaceDB; using namespace WrtDB; @@ -103,18 +103,18 @@ void TaskRemoveBackupFiles::StepDeleteBackupWidgetInterfaceDB() // remove backup database if (remove(backupDbPath.c_str()) != 0) { - _W("Fail to remove"); + LogWarning("Fail to remove"); } } void TaskRemoveBackupFiles::StartStep() { - _D("--------- : START ----------"); + LogDebug("--------- : START ----------"); } void TaskRemoveBackupFiles::EndStep() { - _D("--------- : END ----------"); + LogDebug("--------- : END ----------"); } } //namespace WidgetInstall } //namespace Jobs diff --git a/src/jobs/widget_install/task_smack.cpp b/src/jobs/widget_install/task_smack.cpp index 2dc854c..efe37e7 100644 --- a/src/jobs/widget_install/task_smack.cpp +++ b/src/jobs/widget_install/task_smack.cpp @@ -35,7 +35,6 @@ #include #endif #include -#include using namespace WrtDB; using namespace ValidationCore; @@ -69,7 +68,7 @@ TaskSmack::TaskSmack(InstallerContext& context) : void TaskSmack::StepSetInstall() { - _D("----------------> SMACK: StepStartSetSmack()"); + LogDebug("----------------> SMACK: StepStartSetSmack()"); #ifdef WRT_SMACK_ENABLED std::string pkg = DPL::ToUTF8String(m_context.widgetConfig.tzPkgid); m_pkgId = (char*)calloc(1, pkg.length() + 1); @@ -89,14 +88,15 @@ void TaskSmack::StepSetInstall() void TaskSmack::StepSmackFolderLabeling() { - _D("----------------> SMACK:\ + LogDebug("----------------> SMACK:\ Jobs::WidgetInstall::TaskSmack::SmackFolderLabelingStep()"); #ifdef WRT_SMACK_ENABLED /* /opt/usr/apps/[pkgid] directory's label is "_" */ if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId, m_context.locations->getPackageInstallationDir().c_str(), APP_PATH_ANY_LABEL, "_")) { - _W("Add label to %s", m_context.locations->getPackageInstallationDir().c_str()); + LogWarning("Add label to " << + m_context.locations->getPackageInstallationDir()); } /* for prelaod */ @@ -115,14 +115,14 @@ void TaskSmack::StepSmackFolderLabeling() if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId, resDir.c_str(), APP_PATH_PRIVATE)) { - _W("Add label to %s", resDir.c_str()); + LogWarning("Add label to " << resDir); } /* data directory */ if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId, m_context.locations->getPrivateStorageDir().c_str(), APP_PATH_PRIVATE)) { - _W("Add label to %s", m_context.locations->getPrivateStorageDir().c_str()); + LogWarning("Add label to " << m_context.locations->getPrivateStorageDir()); } /* tmp directory */ @@ -130,18 +130,18 @@ void TaskSmack::StepSmackFolderLabeling() m_context.locations->getPrivateTempStorageDir().c_str(), APP_PATH_PRIVATE)) { - _W("Add label to %s", m_context.locations->getPrivateTempStorageDir().c_str()); + LogWarning("Add label to " << m_context.locations->getPrivateTempStorageDir()); } /* bin directory */ if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId, m_context.locations->getBinaryDir().c_str(), APP_PATH_PRIVATE)) { - _W("Add label to %s", m_context.locations->getBinaryDir().c_str()); + LogWarning("Add label to " << m_context.locations->getBinaryDir()); } if(!setLabelForSharedDir(m_pkgId)) { - _W("Add label to shared directory"); + LogWarning("Add label to shared directory"); } free(m_pkgId); @@ -152,8 +152,8 @@ void TaskSmack::StepSmackFolderLabeling() void TaskSmack::StepSmackPrivilege() { - _D("----------------> SMACK:\ - Jobs::WidgetInstall::TaskSmack::SmackPrivilegeStep()"); + LogDebug("----------------> SMACK:\ + Jobs::WidgetInstall::TaskSmack::SmackPrivilegeStep()"); #ifdef WRT_SMACK_ENABLED /* TODO : std::string id = DPL::ToUTF8String(m_context.widgetConfig.tzAppid); @@ -169,7 +169,7 @@ void TaskSmack::StepSmackPrivilege() char** perm_list = new char*[privileges.size() + 1]; int index = 0; FOREACH(it, privileges) { - _D("Permission : %ls", it->name.c_str()); + LogDebug("Permission : " << it->name); int length = DPL::ToUTF8String(it->name).length(); char *priv = new char[length + 1]; snprintf(priv, length + 1, "%s", @@ -180,7 +180,7 @@ void TaskSmack::StepSmackPrivilege() if (PC_OPERATION_SUCCESS != perm_app_enable_permissions(appId, APP_TYPE_WGT, const_cast(perm_list), true)) { - _W("failure in contructing smack rules based on perm_list"); + LogWarning("failure in contructing smack rules based on perm_list"); } free(appId); @@ -198,27 +198,27 @@ void TaskSmack::StepSmackPrivilege() void TaskSmack::StepRevokeForUpdate() { - _D("----------------> SMACK:\ - Jobs::WidgetInstall::TaskSmack::StepRevokePrivilegeForUpdate()"); + LogDebug("----------------> SMACK:\ + Jobs::WidgetInstall::TaskSmack::StepRevokePrivilegeForUpdate()"); #ifdef WRT_SMACK_ENABLED if (PC_OPERATION_SUCCESS != perm_app_revoke_permissions(m_pkgId)) { - _W("failure in revoking smack permissions"); + LogWarning("failure in revoking smack permissions"); } #endif } void TaskSmack::StepAbortSmack() { - _D("----------------> SMACK:\ + LogDebug("----------------> SMACK:\ Jobs::WidgetInstall::TaskSmack::StepAbortSmack()"); #ifdef WRT_SMACK_ENABLED if (PC_OPERATION_SUCCESS != perm_app_revoke_permissions(m_pkgId)) { - _W("failure in revoking smack permissions"); + LogWarning("failure in revoking smack permissions"); } if (PC_OPERATION_SUCCESS != perm_app_uninstall(m_pkgId)) { - _W("failure in removing smack rules file"); + LogWarning("failure in removing smack rules file"); } free(m_pkgId); #endif @@ -230,14 +230,14 @@ bool TaskSmack::setLabelForSharedDir(const char* pkgId) if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId, m_context.locations->getSharedRootDir().c_str(), APP_PATH_ANY_LABEL, "_")) { - _W("Add label to %s", m_context.locations->getUserDataRootDir().c_str()); + LogWarning("Add label to " << m_context.locations->getUserDataRootDir()); } /* /shared/res directory */ if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId, m_context.locations->getSharedResourceDir().c_str(), APP_PATH_ANY_LABEL, "_")) { - _W("Add label to %s", m_context.locations->getSharedResourceDir().c_str()); + LogWarning("Add label to " << m_context.locations->getSharedResourceDir()); } /* /shared/trusted directory */ @@ -253,12 +253,12 @@ bool TaskSmack::setLabelForSharedDir(const char* pkgId) iPos = sha1String.find("/"); } - _D("sha1 label string : %s", sha1String.c_str()); + LogDebug("sha1 label string : " << sha1String); if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId, m_context.locations->getSharedTrustedDir().c_str(), APP_PATH_GROUP_RW, sha1String.c_str())) { - _W("Add label to %s", m_context.locations->getBinaryDir().c_str()); + LogWarning("Add label to " << m_context.locations->getBinaryDir()); } } @@ -266,7 +266,7 @@ bool TaskSmack::setLabelForSharedDir(const char* pkgId) if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId, m_context.locations->getSharedDataDir().c_str(), APP_PATH_PUBLIC_RO)) { - _W("Add label to %s", m_context.locations->getSharedDataDir().c_str()); + LogWarning("Add label to " << m_context.locations->getSharedDataDir()); } return true; @@ -274,12 +274,12 @@ bool TaskSmack::setLabelForSharedDir(const char* pkgId) void TaskSmack::StartStep() { - _D("--------- : START ----------"); + LogDebug("--------- : START ----------"); } void TaskSmack::EndStep() { - _D("--------- : END ----------"); + LogDebug("--------- : END ----------"); } } //namespace WidgetInstall } //namespace Jobs diff --git a/src/jobs/widget_install/task_update_files.cpp b/src/jobs/widget_install/task_update_files.cpp index 91ab30c..75152ad 100644 --- a/src/jobs/widget_install/task_update_files.cpp +++ b/src/jobs/widget_install/task_update_files.cpp @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -42,8 +43,6 @@ #include #include -#include - using namespace WrtDB; namespace { @@ -68,10 +67,10 @@ TaskUpdateFiles::TaskUpdateFiles(InstallerContext& context) : void TaskUpdateFiles::StepBackupDirectory() { - _D("StepCreateBackupFolder"); + LogDebug("StepCreateBackupFolder"); std::string backPath = m_context.locations->getBackupDir(); - _D("Backup resource directory path : %s", backPath.c_str()); + LogDebug("Backup resource directory path : " << backPath); std::string pkgPath = m_context.locations->getPackageInstallationDir(); if (0 == access(backPath.c_str(), F_OK)) { @@ -80,9 +79,9 @@ void TaskUpdateFiles::StepBackupDirectory() "Error occurs during removing backup resource directory"); } } - _D("copy : %s to %s", pkgPath.c_str(), backPath.c_str()); + LogDebug("copy : " << pkgPath << " to " << backPath); if ((rename(pkgPath.c_str(), backPath.c_str())) != 0) { - _E("Failed to rename %s to %s", pkgPath.c_str(), backPath.c_str()); + LogError("Failed to rename " << pkgPath << " to " << backPath); ThrowMsg(Exceptions::BackupFailed, "Error occurs during rename file"); } @@ -92,25 +91,25 @@ void TaskUpdateFiles::StepBackupDirectory() void TaskUpdateFiles::StepAbortBackupDirectory() { - _D("StepAbortCopyFiles"); + LogDebug("StepAbortCopyFiles"); std::string backPath = m_context.locations->getBackupDir(); std::string pkgPath = m_context.locations->getPackageInstallationDir(); - _D("Backup Folder %s to %s", backPath.c_str(), pkgPath.c_str()); + LogDebug("Backup Folder " << backPath << " to " << pkgPath); if (!WrtUtilRemove(pkgPath)) { - _E("Failed to remove %s", pkgPath.c_str()); + LogError("Failed to remove " << pkgPath); } if (rename(backPath.c_str(), pkgPath.c_str()) != 0) { - _E("Failed to rename %s to %s", backPath.c_str(), pkgPath.c_str()); + LogError("Failed to rename " << backPath << " to " << pkgPath); } } void TaskUpdateFiles::StartStep() { - _D("--------- : START ----------"); + LogDebug("--------- : START ----------"); } void TaskUpdateFiles::EndStep() @@ -119,7 +118,7 @@ void TaskUpdateFiles::EndStep() InstallerContext::INSTALL_CREATE_BACKUP_DIR, "Backup directory created for update"); - _D("--------- : END ----------"); + LogDebug("--------- : END ----------"); } } //namespace WidgetInstall } //namespace Jobs diff --git a/src/jobs/widget_install/task_widget_config.cpp b/src/jobs/widget_install/task_widget_config.cpp index 36de501..161c5e0 100755 --- a/src/jobs/widget_install/task_widget_config.cpp +++ b/src/jobs/widget_install/task_widget_config.cpp @@ -50,8 +50,6 @@ #include #include -#include - namespace { // anonymous const DPL::String BR = DPL::FromUTF8String("
"); const std::string WIDGET_NOT_COMPATIBLE = "This widget is " @@ -94,13 +92,13 @@ void TaskWidgetConfig::StepProcessConfigurationFile() Try { std::string path = m_installContext.locations->getConfigurationDir(); - _D("path: %s", path.c_str()); + LogDebug("path: " << path); processFile(path, m_installContext.widgetConfig); } Catch(Exception::ConfigParseFailed) { - _E("Parsing failed."); + LogError("Parsing failed."); ReThrow(Exceptions::WidgetConfigFileInvalid); } @@ -111,7 +109,7 @@ void TaskWidgetConfig::StepProcessConfigurationFile() void TaskWidgetConfig::ReadLocaleFolders() { - _D("Reading locale"); + LogDebug("Reading locale"); //Adding default locale m_localeFolders.insert(L""); @@ -119,7 +117,7 @@ void TaskWidgetConfig::ReadLocaleFolders() m_installContext.locations->getConfigurationDir() + "/locales"; DIR* localeDir = opendir(localePath.c_str()); if (!localeDir) { - _D("No /locales directory in the widget package."); + LogDebug("No /locales directory in the widget package."); return; } @@ -137,25 +135,26 @@ void TaskWidgetConfig::ReadLocaleFolders() absoluteDirName += dirent.d_name; if (stat(absoluteDirName.c_str(), &statStruct) != 0) { - _E("stat() failed with %s", DPL::GetErrnoString().c_str()); + LogError("stat() failed with " << DPL::GetErrnoString()); continue; } if (S_ISDIR(statStruct.st_mode)) { //Yes, we ignore current, parent & hidden directories if (dirName[0] != L'.') { - _D("Adding locale directory \"%s\"", dirName.c_str()); + LogDebug("Adding locale directory \"" << dirName << "\""); m_localeFolders.insert(dirName); } } } if (return_code != 0 || errno != 0) { - _E("readdir_r() failed with %s", DPL::GetErrnoString().c_str()); + LogError("readdir_r() failed with " << DPL::GetErrnoString()); } if (-1 == TEMP_FAILURE_RETRY(closedir(localeDir))) { - _E("Failed to close dir: %s with error: %s", localePath.c_str(), DPL::GetErrnoString().c_str()); + LogError("Failed to close dir: " << localePath << " with error: " + << DPL::GetErrnoString()); } } @@ -308,7 +307,7 @@ void TaskWidgetConfig::ProcessLocalizedIcons() void TaskWidgetConfig::ProcessIcon(const WrtDB::ConfigParserData::Icon& icon) { - _D("enter"); + LogDebug("enter"); bool isAnyIconValid = false; //In case a default filename is passed as custom filename in config.xml, we //need to keep a set of already processed filenames to avoid icon @@ -342,8 +341,8 @@ void TaskWidgetConfig::ProcessIcon(const WrtDB::ConfigParserData::Icon& icon) if (MimeTypeUtils::isMimeTypeSupportedForIcon(type)) { isAnyIconValid = true; localesAvailableForIcon.insert(*i); - _D("Icon absolutePath: %ls, assigned locale: %ls, type: %ls", - absolutePath.c_str(), (*i).c_str(), type.c_str()); + LogDebug("Icon absolutePath :" << absolutePath << + ", assigned locale :" << *i << ", type: " << type); } } } @@ -358,7 +357,7 @@ void TaskWidgetConfig::ProcessIcon(const WrtDB::ConfigParserData::Icon& icon) void TaskWidgetConfig::ProcessWidgetInstalledPath() { - _D("ProcessWidgetInstalledPath"); + LogDebug("ProcessWidgetInstalledPath"); m_installContext.widgetConfig.widgetInstalledPath = DPL::FromUTF8String( m_installContext.locations->getPackageInstallationDir()); @@ -366,7 +365,7 @@ void TaskWidgetConfig::ProcessWidgetInstalledPath() void TaskWidgetConfig::ProcessAppControlInfo() { - _D("ProcessAppControlInfo"); + LogDebug("ProcessAppControlInfo"); using namespace WrtDB; // In case of dispostion is inline, set the seperate execute @@ -421,7 +420,7 @@ void TaskWidgetConfig::ProcessSecurityModel() } if (isSecurityModelV1 && isSecurityModelV2) { - _E("Security model is conflict"); + LogError("Security model is conflict"); ThrowMsg(Exceptions::NotAllowed, "Security model is conflict"); } else if (isSecurityModelV1) { data.securityModelVersion = @@ -445,7 +444,8 @@ void TaskWidgetConfig::StepCheckMinVersionInfo() m_installContext.widgetConfig.webAppType.appType, m_installContext.widgetConfig.minVersion)) { - _E("Platform version lower than required -> cancelling installation"); + LogError( + "Platform version lower than required -> cancelling installation"); ThrowMsg(Exceptions::NotAllowed, "Platform version does not meet requirements"); } @@ -472,7 +472,7 @@ void TaskWidgetConfig::StepVerifyFeatures() if (!isFeatureAllowed(m_installContext.widgetConfig.webAppType.appType, it->name)) { - _D("This application type not allowed to use this feature"); + LogDebug("This application type not allowed to use this feature"); ThrowMsg( Exceptions::WidgetConfigFileInvalid, "This app type [" << @@ -516,7 +516,7 @@ void TaskWidgetConfig::StepVerifyLivebox() boxType = DPL::ToUTF8String((**it).m_type); } - _D("livebox type: %s", boxType.c_str()); + LogDebug("livebox type: " << boxType); ConfigParserData::LiveboxInfo::BoxSizeList boxSizeList = (**it).m_boxInfo.m_boxSize; @@ -537,7 +537,7 @@ void TaskWidgetConfig::StepVerifyLivebox() free(boxSize); if(!chkSize) { - _E("Invalid boxSize"); + LogError("Invalid boxSize"); ThrowMsg(Exceptions::WidgetConfigFileInvalid, "Invalid boxSize"); } } @@ -547,8 +547,9 @@ bool TaskWidgetConfig::isFeatureAllowed(WrtDB::AppType appType, DPL::String featureName) { using namespace WrtDB; - _D("AppType = [%s]", WidgetType(appType).getApptypeToString().c_str()); - _D("FetureName = [%ls]", featureName.c_str()); + LogDebug("AppType = [" << + WidgetType(appType).getApptypeToString() << "]"); + LogDebug("FetureName = [" << featureName << "]"); AppType featureType = APP_TYPE_UNKNOWN; std::string featureStr = DPL::ToUTF8String(featureName); @@ -582,13 +583,13 @@ bool TaskWidgetConfig::parseVersionString(const std::string &version, std::istringstream inputString(version); inputString >> majorVersion; if (inputString.bad() || inputString.fail()) { - _W("Invalid minVersion format."); + LogWarning("Invalid minVersion format."); return false; } inputString.get(); // skip period inputString >> minorVersion; if (inputString.bad() || inputString.fail()) { - _W("Invalid minVersion format"); + LogWarning("Invalid minVersion format"); return false; } else { inputString.get(); // skip period @@ -608,8 +609,8 @@ bool TaskWidgetConfig::isMinVersionCompatible( if (appType == WrtDB::AppType::APP_TYPE_TIZENWEBAPP) { return false; } else { - _W("minVersion attribute is empty. WRT assumes platform " - "supports this widget."); + LogWarning("minVersion attribute is empty. WRT assumes platform " + "supports this widget."); return true; } } @@ -619,7 +620,7 @@ bool TaskWidgetConfig::isMinVersionCompatible( if (!parseVersionString(DPL::ToUTF8String(*widgetVersion), majorWidget, minorWidget, microWidget)) { - _W("Invalid format of widget version string."); + LogWarning("Invalid format of widget version string."); return false; } @@ -629,14 +630,14 @@ bool TaskWidgetConfig::isMinVersionCompatible( if (appType == WrtDB::AppType::APP_TYPE_TIZENWEBAPP) { version = WrtDB::GlobalConfig::GetTizenVersion(); } else { - _W("Invaild AppType"); + LogWarning("Invaild AppType"); return false; } if (!parseVersionString(version, majorSupported, minorSupported, microSupported)) { - _W("Invalid format of platform version string."); + LogWarning("Invalid format of platform version string."); return true; } @@ -645,7 +646,7 @@ bool TaskWidgetConfig::isMinVersionCompatible( (majorWidget == majorSupported && minorWidget == minorSupported && microWidget > microSupported)) { - _D("Platform doesn't support this widget."); + LogDebug("Platform doesn't support this widget."); return false; } return true; @@ -679,7 +680,7 @@ bool TaskWidgetConfig::parseConfigurationFileBrowser( } Catch(ElementParser::Exception::Base) { - _E("Invalid widget configuration file!"); + LogError("Invalid widget configuration file!"); return false; } return true; @@ -693,11 +694,11 @@ bool TaskWidgetConfig::parseConfigurationFileWidget( WrtUtilJoinPaths(configFilePath, _currentPath, WRT_WIDGET_CONFIG_FILE_NAME); if (!WrtUtilFileExists(configFilePath)) { - _E("Archive does not contain configuration file"); + LogError("Archive does not contain configuration file"); return false; } - _D("Configuration file: %s", configFilePath.c_str()); + LogDebug("Configuration file: " << configFilePath); Try { @@ -705,7 +706,7 @@ bool TaskWidgetConfig::parseConfigurationFileWidget( #ifdef SCHEMA_VALIDATION_ENABLED if(!parser.Validate(configFilePath, WRT_WIDGETS_XML_SCHEMA)) { - _E("Invalid configuration file - schema validation failed"); + LogError("Invalid configuration file - schema validation failed"); return false; } #endif @@ -717,7 +718,7 @@ bool TaskWidgetConfig::parseConfigurationFileWidget( } Catch (ElementParser::Exception::Base) { - _E("Invalid configuration file!"); + LogError("Invalid configuration file!"); return false; } } @@ -768,7 +769,7 @@ bool TaskWidgetConfig::fillWidgetConfig( pWidgetConfigInfo.guid = configInfo.widget_id; } else { if (pWidgetConfigInfo.guid != configInfo.widget_id) { - _E("Invalid archive"); + LogError("Invalid archive"); return false; } } @@ -777,13 +778,13 @@ bool TaskWidgetConfig::fillWidgetConfig( if (DPL::ToUTF8String(pWidgetConfigInfo.tzAppid).compare( DPL::ToUTF8String(*configInfo.tizenAppId)) < 0) { - _E("Invalid archive - Tizen App ID not same error"); + LogError("Invalid archive - Tizen App ID not same error"); return false; } } if (!!configInfo.tizenPkgId) { if (pWidgetConfigInfo.tzPkgid != *configInfo.tizenPkgId) { - _E("Invalid archive - Tizen Pkg ID not same error"); + LogError("Invalid archive - Tizen Pkg ID not same error"); return false; } } @@ -792,7 +793,7 @@ bool TaskWidgetConfig::fillWidgetConfig( pWidgetConfigInfo.version = configInfo.version; } else { if (pWidgetConfigInfo.version != configInfo.version) { - _E("Invalid archive"); + LogError("Invalid archive"); return false; } } @@ -813,19 +814,19 @@ void TaskWidgetConfig::processFile( if (!locateAndParseConfigurationFile(path, widgetConfiguration, DEFAULT_LANGUAGE)) { - _W("Widget archive: Failed while parsing config file"); + LogWarning("Widget archive: Failed while parsing config file"); ThrowMsg(Exception::ConfigParseFailed, path); } } void TaskWidgetConfig::StartStep() { - _D("---------- : START ----------"); + LogDebug("--------- : START ----------"); } void TaskWidgetConfig::EndStep() { - _D("---------- : END ----------"); + LogDebug("--------- : END ----------"); } } //namespace WidgetInstall } //namespace Jobs diff --git a/src/jobs/widget_install/widget_unzip.cpp b/src/jobs/widget_install/widget_unzip.cpp index 100a748..28ef7b2 100644 --- a/src/jobs/widget_install/widget_unzip.cpp +++ b/src/jobs/widget_install/widget_unzip.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -30,7 +31,6 @@ #include #include #include -#include using namespace WrtDB; @@ -90,8 +90,10 @@ void WidgetUnzip::ExtractFile(DPL::ZipInput::File *input, void WidgetUnzip::unzipProgress(const std::string &destination) { // Show file info - _D("Unzipping: '%s', Comment: '%s', Compressed size: %lld, Uncompressed size: %lld", - m_zipIterator->name.c_str(), m_zipIterator->comment.c_str(), m_zipIterator->compressedSize, m_zipIterator->uncompressedSize); + LogDebug("Unzipping: '" << m_zipIterator->name << + "', Comment: '" << m_zipIterator->comment << + "', Compressed size: " << m_zipIterator->compressedSize << + ", Uncompressed size: " << m_zipIterator->uncompressedSize); // Normalize file paths // FIXME: Implement checking for invalid characters @@ -103,7 +105,7 @@ void WidgetUnzip::unzipProgress(const std::string &destination) // This is path std::string newPath = destination + "/" + fileName.substr(0, fileName.size() - 1); - _D("Path to extract: %s", newPath.c_str()); + LogPedantic("Path to extract: " << newPath); // Create path in case of it is empty createTempPath(newPath); @@ -111,12 +113,14 @@ void WidgetUnzip::unzipProgress(const std::string &destination) // This is regular file std::string fileExtractPath = destination + "/" + fileName; - _D("File to extract: %s", fileExtractPath.c_str()); + LogPedantic("File to extract: " << fileExtractPath); // Split into pat & file pair PathAndFilePair pathAndFile = SplitFileAndPath(fileExtractPath); - _D("Path and file: %s : %s", pathAndFile.path.c_str(), pathAndFile.file.c_str()); + LogPedantic("Path and file: " << + pathAndFile.path << + " : " << pathAndFile.file); // First, ensure that path exists createTempPath(pathAndFile.path); @@ -138,7 +142,7 @@ void WidgetUnzip::unzipProgress(const std::string &destination) // Check whether there are more files to extract if (++m_zipIterator == m_zip->end()) { - _D("Unzip progress finished successfuly"); + LogDebug("Unzip progress finished successfuly"); } else { unzipProgress(destination); } @@ -146,7 +150,7 @@ void WidgetUnzip::unzipProgress(const std::string &destination) bool WidgetUnzip::isDRMPackage(const std::string &source) { - _D("Enter : isDRMPackage()"); + LogDebug("Enter : isDRMPackage()"); int ret = 0; void* pHandle = NULL; char* pErrorMsg = NULL; @@ -154,7 +158,7 @@ bool WidgetUnzip::isDRMPackage(const std::string &source) pHandle = dlopen(DRM_LIB_PATH, RTLD_LAZY | RTLD_GLOBAL); if (!pHandle) { - _E("dlopen failed : %s [%s]", source.c_str(), dlerror()); + LogError("dlopen failed : " << source << " [" << dlerror() << "]"); return false; } @@ -162,7 +166,7 @@ bool WidgetUnzip::isDRMPackage(const std::string &source) (dlsym(pHandle, "drm_oem_sapps_is_drm_file")); pErrorMsg = dlerror(); if ((pErrorMsg != NULL) || (drm_oem_sapps_is_drm_file == NULL)) { - _E("dlopen failed : %s [%s]", source.c_str(), dlerror()); + LogError("dlopen failed : " << source << " [" << dlerror() << "]"); dlclose(pHandle); return false; } @@ -170,17 +174,17 @@ bool WidgetUnzip::isDRMPackage(const std::string &source) ret = drm_oem_sapps_is_drm_file(source.c_str(), source.length()); dlclose(pHandle); if (1 == ret) { - _D("%s is DRM file", source.c_str()); + LogDebug(source << " is DRM file"); return true; } - _D("%s isn't DRM file", source.c_str()); + LogDebug(source << " isn't DRM file"); return false; } bool WidgetUnzip::decryptDRMPackage(const std::string &source, const std::string &decryptedSource) { - _D("Enter : decryptDRMPackage()"); + LogDebug("Enter : decryptDRMPackage()"); int ret = 0; void* pHandle = NULL; char* pErrorMsg = NULL; @@ -189,7 +193,7 @@ bool WidgetUnzip::decryptDRMPackage(const std::string &source, const std::string pHandle = dlopen(DRM_LIB_PATH, RTLD_LAZY | RTLD_GLOBAL); if (!pHandle) { - _E("dlopen failed : %s [%s]", source.c_str(), dlerror()); + LogError("dlopen failed : " << source << " [" << dlerror() << "]"); return false; } @@ -198,7 +202,7 @@ bool WidgetUnzip::decryptDRMPackage(const std::string &source, const std::string (dlsym(pHandle, "drm_oem_sapps_decrypt_package")); pErrorMsg = dlerror(); if ((pErrorMsg != NULL) || (drm_oem_sapps_decrypt_package == NULL)) { - _E("dlopen failed : %s [%s]", source.c_str(), dlerror()); + LogError("dlopen failed : " << source << " [" << dlerror() << "]"); dlclose(pHandle); return false; } @@ -207,7 +211,7 @@ bool WidgetUnzip::decryptDRMPackage(const std::string &source, const std::string decryptedSource.c_str(), decryptedSource.length()); dlclose(pHandle); if (1 == ret) { - _D("%s is decrypted : %s", source.c_str(), decryptedSource.c_str()); + LogDebug(source << " is decrypted : " << decryptedSource); return true; } return false; @@ -215,7 +219,7 @@ bool WidgetUnzip::decryptDRMPackage(const std::string &source, const std::string std::string WidgetUnzip::getDecryptedPackage(const std::string &source) { - _D("Check DRM..."); + LogDebug("Check DRM..."); if (isDRMPackage(source)) { std::string decryptedFile; size_t found = source.find_last_of(".wgt"); @@ -226,9 +230,9 @@ std::string WidgetUnzip::getDecryptedPackage(const std::string &source) 1) + "_tmp.wgt"; } - _D("decrypted file name : %s", decryptedFile.c_str()); + LogDebug("decrypted file name : " << decryptedFile); if (!decryptDRMPackage(source, decryptedFile)) { - _E("Failed decrypt drm file"); + LogError("Failed decrypt drm file"); ThrowMsg(Exceptions::DrmDecryptFailed, source); } return decryptedFile; @@ -238,16 +242,15 @@ std::string WidgetUnzip::getDecryptedPackage(const std::string &source) void WidgetUnzip::unzipWgtFile(const std::string &source, const std::string &destination) { - _D("Prepare to unzip..."); + LogDebug("Prepare to unzip..."); std::string wgtFile; Try { wgtFile = getDecryptedPackage(source); - _D("wgtFile : %s", wgtFile.c_str()); + LogDebug("wgtFile : " << wgtFile); m_zip.reset(new DPL::ZipInput(wgtFile)); - _D("Widget package comment: %s", m_zip->GetGlobalComment().c_str()); - + LogDebug("Widget package comment: " << m_zip->GetGlobalComment()); // Widget package must not be empty if (m_zip->empty()) { @@ -263,7 +266,7 @@ void WidgetUnzip::unzipWgtFile(const std::string &source, const std::string &des m_zip.reset(); // Done - _D("Unzip finished"); + LogDebug("Unzip finished"); } Catch(DPL::ZipInput::Exception::OpenFailed) { diff --git a/src/jobs/widget_uninstall/job_widget_uninstall.cpp b/src/jobs/widget_uninstall/job_widget_uninstall.cpp index cc5044d..c02adb9 100644 --- a/src/jobs/widget_uninstall/job_widget_uninstall.cpp +++ b/src/jobs/widget_uninstall/job_widget_uninstall.cpp @@ -29,7 +29,6 @@ #include #include #include -#include using namespace WrtDB; @@ -104,7 +103,7 @@ JobWidgetUninstall::JobWidgetUninstall( m_context.installedPath = DPL::Utils::Path(*dao.getWidgetInstalledPath()); - _D("Widget model exists. App id : %s", m_context.tzAppid.c_str()); + LogDebug("Widget model exists. App id : " << m_context.tzAppid); // send start signal of pkgmgr if (GetInstallerStruct().pkgmgrInterface->setPkgname(m_context.tzPkgid)) @@ -143,7 +142,7 @@ WidgetStatus JobWidgetUninstall::getWidgetStatus(const std::string &id) { regex_t regx; if(regcomp(®x, REG_TIZEN_PKGID_PATTERN, REG_NOSUB | REG_EXTENDED)!=0){ - _D("Regcomp failed"); + LogDebug("Regcomp failed"); } std::string pkgId; DPL::Utils::Path installPath; @@ -156,7 +155,7 @@ WidgetStatus JobWidgetUninstall::getWidgetStatus(const std::string &id) TizenAppId appid = WrtDB::WidgetDAOReadOnly::getTzAppId( DPL::FromUTF8String(id)); - _D("Get appid from pkgid : %ls", appid.c_str()); + LogDebug("Get appid from pkgid : " << appid); m_context.tzAppid = DPL::ToUTF8String(appid); WrtDB::WidgetDAOReadOnly dao(appid); installPath = DPL::Utils::Path(*dao.getWidgetInstalledPath()); @@ -167,14 +166,14 @@ WidgetStatus JobWidgetUninstall::getWidgetStatus(const std::string &id) installPath = DPL::Utils::Path(*dao.getWidgetInstalledPath()); } if(installPath.isSubPath(PRELOAD_INSTALLED_PATH)){ - _D("This widget is prealoded."); + LogDebug("This widget is preloaded."); } } Catch(WidgetDAOReadOnly::Exception::WidgetNotExist) { - _D("package id : %s", pkgId.c_str()); + LogDebug("package id : " << pkgId); m_context.tzPkgid = pkgId; if (!pkgId.empty()) { if(checkDirectoryExist(pkgId)) { - _E("installed widget status is abnormal"); + LogError("installed widget status is abnormal"); return WidgetStatus::ABNORMAL; } } @@ -209,7 +208,7 @@ void JobWidgetUninstall::SendProgress() std::ostringstream percent; percent << static_cast(GetProgressPercent()); - _D("Call widget uninstall progressCallback"); + LogDebug("Call widget uninstall progressCallback"); GetInstallerStruct().progressCallback( GetInstallerStruct().userParam, GetProgressPercent(), GetProgressDescription()); @@ -225,7 +224,7 @@ void JobWidgetUninstall::SendFinishedSuccess() PKGMGR_END_KEY, PKGMGR_END_SUCCESS); - _D("Call widget uninstall success finishedCallback"); + LogDebug("Call widget uninstall success finishedCallback"); GetInstallerStruct().finishedCallback(GetInstallerStruct().userParam, getRemovedTizenId(), Jobs::Exceptions::Success); @@ -234,19 +233,19 @@ void JobWidgetUninstall::SendFinishedSuccess() void JobWidgetUninstall::SendFinishedFailure() { using namespace PackageManager; - _E("Error in uninstallation step: %d", m_exceptionCaught); - _E("Message: %s", m_exceptionMessage.c_str()); + LogError("Error in uninstallation step: " << m_exceptionCaught); + LogError("Message: " << m_exceptionMessage); // send signal of pkgmgr GetInstallerStruct().pkgmgrInterface->sendSignal( PKGMGR_END_KEY, PKGMGR_END_FAILURE); - _D("Call widget uninstall failure finishedCallback"); + LogDebug("Call widget uninstall failure finishedCallback"); GetInstallerStruct().finishedCallback(GetInstallerStruct().userParam, getRemovedTizenId(), m_exceptionCaught); - _D("[JobWidgetUninstall] Asynchronous failure callback status sent"); + LogDebug("[JobWidgetUninstall] Asynchronous failure callback status sent"); } void JobWidgetUninstall::SaveExceptionData(const Jobs::JobExceptionBase &e) diff --git a/src/jobs/widget_uninstall/task_check.cpp b/src/jobs/widget_uninstall/task_check.cpp index 56af94c..8670ed1 100644 --- a/src/jobs/widget_uninstall/task_check.cpp +++ b/src/jobs/widget_uninstall/task_check.cpp @@ -28,7 +28,6 @@ #include #include #include -#include namespace Jobs { namespace WidgetUninstall { @@ -46,14 +45,14 @@ TaskCheck::~TaskCheck() void TaskCheck::StartStep() { - _D("--------- : START ----------"); + LogDebug("--------- : START ----------"); } void TaskCheck::EndStep() { m_context.job->UpdateProgress(UninstallerContext::UNINSTALL_PRECHECK, "Uninstall pre-checking Finished"); - _D("--------- : END ----------"); + LogDebug("--------- : END ----------"); } void TaskCheck::StepUninstallPreCheck() @@ -61,7 +60,7 @@ void TaskCheck::StepUninstallPreCheck() bool isRunning = false; int ret = app_manager_is_running(m_context.tzAppid.c_str(), &isRunning); if (APP_MANAGER_ERROR_NONE != ret) { - _E("Fail to get running state"); + LogError("Fail to get running state"); ThrowMsg(Exceptions::PlatformAPIFailure, "Fail to get widget state"); } @@ -72,7 +71,7 @@ void TaskCheck::StepUninstallPreCheck() app_context_h appCtx = NULL; ret = app_manager_get_app_context(m_context.tzAppid.c_str(), &appCtx); if (APP_MANAGER_ERROR_NONE != ret) { - _E("Fail to get app_context"); + LogError("Fail to get app_context"); ThrowMsg(Exceptions::AppIsRunning, "Widget is not stopped. Cannot uninstall!"); } @@ -80,7 +79,7 @@ void TaskCheck::StepUninstallPreCheck() // terminate app_context_h ret = app_manager_terminate_app(appCtx); if (APP_MANAGER_ERROR_NONE != ret) { - _E("Fail to terminate running application"); + LogError("Fail to terminate running application"); app_context_destroy(appCtx); ThrowMsg(Exceptions::AppIsRunning, "Widget is not stopped. Cannot uninstall!"); @@ -95,7 +94,7 @@ void TaskCheck::StepUninstallPreCheck() nanosleep(&duration, NULL); int ret = app_manager_is_running(m_context.tzAppid.c_str(), &isStillRunning); if (APP_MANAGER_ERROR_NONE != ret) { - _E("Fail to get running state"); + LogError("Fail to get running state"); ThrowMsg(Exceptions::PlatformAPIFailure, "Fail to get widget state"); } @@ -104,15 +103,15 @@ void TaskCheck::StepUninstallPreCheck() } } if (isStillRunning) { - _E("Fail to terminate running application"); + LogError("Fail to terminate running application"); ThrowMsg(Exceptions::AppIsRunning, "Widget is not stopped. Cannot uninstall!"); } - _D("terminate application"); + LogDebug("terminate application"); } } - _D("Widget Can be uninstalled, Pkgname : %s", m_context.tzAppid.c_str()); + LogDebug("Widget Can be uninstalled. Pkgname : " << m_context.tzAppid); } } //namespace WidgetUninstall } //namespace Jobs diff --git a/src/jobs/widget_uninstall/task_db_update.cpp b/src/jobs/widget_uninstall/task_db_update.cpp index e505b10..a3462f6 100644 --- a/src/jobs/widget_uninstall/task_db_update.cpp +++ b/src/jobs/widget_uninstall/task_db_update.cpp @@ -31,7 +31,6 @@ #include #include #include -#include using namespace WrtDB; @@ -63,11 +62,11 @@ void TaskDbUpdate::StepDbUpdate() tzAppid)))); WidgetDAO::unregisterWidget(DPL::FromUTF8String(m_context.tzAppid)); - _D("Unregistered widget successfully!"); + LogDebug("Unregistered widget successfully!"); } Catch(DPL::DB::SqlConnection::Exception::Base) { - _E("Failed to handle StepDbUpdate!"); + LogError("Failed to handle StepDbUpdate!"); ReThrowMsg(Exceptions::DatabaseFailure, "Failed to handle StepDbUpdate!"); } @@ -79,9 +78,9 @@ void TaskDbUpdate::StepLiveboxDBDelete() web_provider_livebox_delete_by_app_id(m_context.tzAppid.c_str()); if (ret < 0) { - _D("failed to delete box info"); + LogDebug("failed to delete box info"); } else { - _D("delete box info: %s", m_context.tzAppid.c_str()); + LogDebug("delete box info: " << m_context.tzAppid); } } @@ -89,21 +88,21 @@ void TaskDbUpdate::StepRemoveExternalLocations() { if (!m_context.removeAbnormal) { WidgetDAO dao(DPL::FromUTF8String(m_context.tzAppid)); - _D("Removing external locations:"); + LogDebug("Removing external locations:"); WrtDB::ExternalLocationList externalPaths = dao.getWidgetExternalLocations(); FOREACH(file, externalPaths) { DPL::Utils::Path path(*file); if(path.Exists()){ if(path.IsFile()){ - _D(" -> %ls", path.Fullpath().c_str()); + LogDebug(" -> " << path.Fullpath()); Try{ DPL::Utils::Remove(path); }Catch(DPL::Utils::Path::BaseException){ - _E("Failed to remove the file: %ls", path.Fullpath().c_str()); + LogError("Failed to remove the file: " << path.Fullpath()); } } else if (path.IsDir()){ - _D(" -> %ls", path.Fullpath().c_str()); + LogDebug(" -> " << path.Fullpath()); Try{ DPL::Utils::Remove(path); }Catch(DPL::Utils::Path::BaseException){ @@ -112,7 +111,7 @@ void TaskDbUpdate::StepRemoveExternalLocations() } } }else{ - _W(" -> %ls(no such a path)", path.Fullpath().c_str()); + LogWarning(" -> " << path.Fullpath() << "(no such a path)"); } } dao.unregisterAllExternalLocations(); @@ -121,7 +120,7 @@ void TaskDbUpdate::StepRemoveExternalLocations() void TaskDbUpdate::StartStep() { - _D("--------- : START ----------"); + LogDebug("--------- : START ----------"); } void TaskDbUpdate::EndStep() @@ -130,7 +129,7 @@ void TaskDbUpdate::EndStep() UninstallerContext::UNINSTALL_DB_UPDATE, "Widget DB Update Finished"); - _D("--------- : END ----------"); + LogDebug("--------- : END ----------"); } } //namespace WidgetUninstall } //namespace Jobs diff --git a/src/jobs/widget_uninstall/task_delete_pkginfo.cpp b/src/jobs/widget_uninstall/task_delete_pkginfo.cpp index d86af93..838a9fd 100644 --- a/src/jobs/widget_uninstall/task_delete_pkginfo.cpp +++ b/src/jobs/widget_uninstall/task_delete_pkginfo.cpp @@ -29,7 +29,6 @@ #include #include #include -#include namespace Jobs { namespace WidgetUninstall { @@ -45,12 +44,12 @@ TaskDeletePkgInfo::TaskDeletePkgInfo( void TaskDeletePkgInfo::StartStep() { - _D("--------- : START ----------"); + LogDebug("--------- : START ----------"); } void TaskDeletePkgInfo::EndStep() { - _D("--------- : END ----------"); + LogDebug("--------- : END ----------"); } void TaskDeletePkgInfo::StepDeletePkgInfo() @@ -64,7 +63,7 @@ void TaskDeletePkgInfo::StepDeletePkgInfo() if (0 == (m_context.installedPath.Fullpath()).compare(0, PRELOAD_INSTALLED_PATH.Fullpath().length(), PRELOAD_INSTALLED_PATH.Fullpath())) { - _D("This widget is preloaded."); + LogDebug("This widget is preloaded."); destFile = USR_PACKAGES_PATH; } else { destFile = OPT_PACKAGES_PATH; @@ -76,13 +75,13 @@ void TaskDeletePkgInfo::StepDeletePkgInfo() if (!(destFile.Exists() == 0 && pre_manifest.Exists())) { if (0 != pkgmgr_parser_parse_manifest_for_uninstallation( destFile.Fullpath().c_str(), NULL)) { - _W("Manifest file failed to parse for uninstallation"); + LogWarning("Manifest file failed to parse for uninstallation"); } } if (!DPL::Utils::TryRemove(destFile)) { - _W("No manifest file found: %s", destFile.Fullpath().c_str()); + LogWarning("No manifest file found: " << destFile.Fullpath()); } else { - _D("Manifest file removed: %s", destFile.Fullpath().c_str()); + LogDebug("Manifest file removed: " << destFile.Fullpath()); } } } //namespace WidgetUninstall diff --git a/src/jobs/widget_uninstall/task_remove_custom_handlers.cpp b/src/jobs/widget_uninstall/task_remove_custom_handlers.cpp index f981b0c..706ab03 100644 --- a/src/jobs/widget_uninstall/task_remove_custom_handlers.cpp +++ b/src/jobs/widget_uninstall/task_remove_custom_handlers.cpp @@ -22,11 +22,11 @@ #include #include +#include #include #include #include #include -#include namespace Jobs { namespace WidgetUninstall { @@ -42,9 +42,9 @@ TaskRemoveCustomHandlers::TaskRemoveCustomHandlers(UninstallerContext& context) void TaskRemoveCustomHandlers::Step() { - _D("Removing widget from appsvc"); + LogDebug("Removing widget from appsvc"); int result = appsvc_unset_defapp(m_context.tzAppid.c_str()); - _D("Result: %d", result); + LogDebug("Result: " << result); CustomHandlerDB::Interface::attachDatabaseRW(); CustomHandlerDB::CustomHandlerDAO handlersDao( @@ -56,12 +56,12 @@ void TaskRemoveCustomHandlers::Step() void TaskRemoveCustomHandlers::StartStep() { - _D("--------- : START ----------"); + LogDebug("--------- : START ----------"); } void TaskRemoveCustomHandlers::EndStep() { - _D("--------- : END ----------"); + LogDebug("--------- : END ----------"); } } //namespace WidgetUninstall } //namespace Jobs diff --git a/src/jobs/widget_uninstall/task_remove_files.cpp b/src/jobs/widget_uninstall/task_remove_files.cpp index 89f0e1d..c02f0a9 100644 --- a/src/jobs/widget_uninstall/task_remove_files.cpp +++ b/src/jobs/widget_uninstall/task_remove_files.cpp @@ -36,7 +36,6 @@ #include #include #include -#include namespace Jobs { namespace WidgetUninstall { @@ -57,27 +56,28 @@ TaskRemoveFiles::~TaskRemoveFiles() void TaskRemoveFiles::StepRemoveInstallationDirectory() { - _D("StepRemoveInstallationDirectory started"); + LogDebug("StepRemoveInstallationDirectory started"); Try { int ret = app2ext_get_app_location(m_context.tzPkgid.c_str()); if (APP2EXT_INTERNAL_MEM == ret) { - _D("Removing directory"); + LogDebug("Removing directory"); m_context.removeStarted = true; DPL::Utils::Path widgetDir= m_context.installedPath; Try{ DPL::Utils::Remove(widgetDir); } Catch(DPL::Utils::Path::BaseException){ - _E("Removing widget installation directory failed : %ls", widgetDir.Fullpath().c_str()); + LogError("Removing widget installation directory failed : " << + widgetDir.Fullpath()); } DPL::Utils::Path dataDir(m_context.locations->getUserDataRootDir()); Try{ DPL::Utils::Remove(dataDir); } Catch(DPL::Utils::Path::BaseException){ - _W("%ls is already removed", dataDir.Fullpath().c_str()); + LogWarning(dataDir.Fullpath() << " is already removed"); } } else if (APP2EXT_SD_CARD == ret) { - _D("Removing sdcard directory"); + LogDebug("Removing sdcard directory"); Try { WidgetInstallToExtSingleton::Instance().initialize(m_context.tzPkgid); WidgetInstallToExtSingleton::Instance().uninstallation(); @@ -89,7 +89,7 @@ void TaskRemoveFiles::StepRemoveInstallationDirectory() RemoveFilesFailed); } } else { - _E("app is not installed"); + LogError("app is not installed"); ThrowMsg(Exceptions::WidgetNotExist, "failed to get app location"); } } Catch(Exception::RemoveFilesFailed) { @@ -102,7 +102,7 @@ void TaskRemoveFiles::StepRemoveInstallationDirectory() void TaskRemoveFiles::StepRemoveFinished() { - _D("StepRemoveFinished finished"); + LogDebug("StepRemoveFinished finished"); m_context.job->UpdateProgress( UninstallerContext::UNINSTALL_REMOVE_FINISHED, @@ -111,12 +111,12 @@ void TaskRemoveFiles::StepRemoveFinished() void TaskRemoveFiles::StartStep() { - _D("--------- : START ----------"); + LogDebug("--------- : START ----------"); } void TaskRemoveFiles::EndStep() { - _D("--------- : END ----------"); + LogDebug("--------- : END ----------"); } } //namespace WidgetUninstall } //namespace Jobs diff --git a/src/jobs/widget_uninstall/task_smack.cpp b/src/jobs/widget_uninstall/task_smack.cpp index e3471b3..c8079a2 100644 --- a/src/jobs/widget_uninstall/task_smack.cpp +++ b/src/jobs/widget_uninstall/task_smack.cpp @@ -23,9 +23,8 @@ #include #include #include +#include #include -#include - #ifdef WRT_SMACK_ENABLED #include #endif @@ -43,22 +42,23 @@ TaskSmack::TaskSmack(UninstallerContext& context) : void TaskSmack::Step() { - _D("------------------------> SMACK: Jobs::WidgetUninstall::TaskSmack::Step()"); + LogDebug( + "------------------------> SMACK: Jobs::WidgetUninstall::TaskSmack::Step()"); #ifdef WRT_SMACK_ENABLED const char* pkgId = m_context.tzPkgid.c_str(); if (PC_OPERATION_SUCCESS != perm_app_revoke_permissions(pkgId)) { - _E("failure in revoking smack permissions"); + LogError("failure in revoking smack permissions"); } if (PC_OPERATION_SUCCESS != perm_app_uninstall(pkgId)) { - _E("failure in removing smack rules file"); + LogError("failure in removing smack rules file"); } #endif } void TaskSmack::StartStep() { - _D("--------- : START ----------"); + LogDebug("--------- : START ----------"); } void TaskSmack::EndStep() @@ -67,7 +67,7 @@ void TaskSmack::EndStep() UninstallerContext::UNINSTALL_SMACK_DISABLE, "Widget SMACK Disabled"); - _D("--------- : END ----------"); + LogDebug("--------- : END ----------"); } } //namespace WidgetUninstall } //namespace Jobs diff --git a/src/jobs/widget_uninstall/task_uninstall_ospsvc.cpp b/src/jobs/widget_uninstall/task_uninstall_ospsvc.cpp index 10cf130..20a6027 100644 --- a/src/jobs/widget_uninstall/task_uninstall_ospsvc.cpp +++ b/src/jobs/widget_uninstall/task_uninstall_ospsvc.cpp @@ -27,7 +27,6 @@ #include #include #include -#include using namespace WrtDB; @@ -52,17 +51,17 @@ TaskUninstallOspsvc::~TaskUninstallOspsvc() void TaskUninstallOspsvc::StepUninstallOspsvc() { - _D("Step : Uninstall Osp service"); + LogDebug("Step : Uninstall Osp service "); std::ostringstream commStr; commStr << OSP_INSTALL_STR << BashUtils::escape_arg(m_context.tzPkgid); - _D("osp uninstall command : %s", commStr.str().c_str()); + LogDebug("osp uninstall command : " << commStr.str()); char readBuf[MAX_BUF_SIZE]; FILE *fd; fd = popen(commStr.str().c_str(), "r"); if (NULL == fd) { - _E("Failed to uninstalltion osp service"); + LogError("Failed to uninstalltion osp service"); ThrowMsg(Exceptions::UninstallOspSvcFailed, "Error occurs during\ uninstall osp service"); @@ -70,13 +69,13 @@ void TaskUninstallOspsvc::StepUninstallOspsvc() if(fgets(readBuf, MAX_BUF_SIZE, fd) == NULL) { - _E("Failed to uninstalltion osp service\ + LogError("Failed to uninstalltion osp service\ Inability of reading file."); ThrowMsg(Exceptions::UninstallOspSvcFailed, "Error occurs during\ uninstall osp service"); } - _D("return value : %s", readBuf); + LogDebug("return value : " << readBuf); int result = atoi(readBuf); if (0 != result) { @@ -87,19 +86,19 @@ void TaskUninstallOspsvc::StepUninstallOspsvc() pclose(fd); - _D("Widget Can be uninstalled. Pkgname : %s", m_context.tzPkgid.c_str()); + LogDebug("Widget Can be uninstalled. Pkgname : " << m_context.tzPkgid); m_context.job->UpdateProgress(UninstallerContext::UNINSTALL_REMOVE_OSPSVC, "Uninstall OSP service finished"); } void TaskUninstallOspsvc::StartStep() { - _D("--------- : START ----------"); + LogDebug("--------- : START ----------"); } void TaskUninstallOspsvc::EndStep() { - _D("--------- : END ----------"); + LogDebug("--------- : END ----------"); } } //namespace WidgetUninstall } //namespace Jobs diff --git a/src/logic/installer_controller.cpp b/src/logic/installer_controller.cpp index 658ed20..ced23fd 100644 --- a/src/logic/installer_controller.cpp +++ b/src/logic/installer_controller.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ #include "installer_controller.h" +#include #include IMPLEMENT_SINGLETON(Logic::InstallerController) diff --git a/src/logic/installer_logic.cpp b/src/logic/installer_logic.cpp index 13d642a..bb42034 100644 --- a/src/logic/installer_logic.cpp +++ b/src/logic/installer_logic.cpp @@ -24,7 +24,6 @@ #include #include #include -#include using namespace WrtDB; @@ -41,7 +40,7 @@ InstallerLogic::~InstallerLogic() void InstallerLogic::Initialize() { - _D("Done"); + LogDebug("Done"); } void InstallerLogic::Terminate() @@ -50,7 +49,7 @@ void InstallerLogic::Terminate() if(m_job) m_job->SetPaused(true); - _D("Done"); + LogDebug("Done"); } Jobs::JobHandle InstallerLogic::AddAndStartJob() @@ -73,11 +72,11 @@ Jobs::JobHandle InstallerLogic::InstallWidget( { if(m_job) { - _E("Job is in progress. It is impossible to add new job"); + LogError("Job is in progress. It is impossible to add new job"); return -1; } - _D("New Widget Installation:"); + LogDebug("New Widget Installation:"); m_job = new Jobs::WidgetInstall::JobWidgetInstall(widgetPath, installerStruct); @@ -93,11 +92,11 @@ Jobs::JobHandle InstallerLogic::UninstallWidget( { if(m_job) { - _E("Job is in progress. It is impossible to add new job"); + LogError("Job is in progress. It is impossible to add new job"); return -1; } - _D("New Widget Uninstallation"); + LogDebug("New Widget Uninstallation"); m_job = new Jobs::WidgetUninstall::JobWidgetUninstall(widgetPkgName, @@ -113,11 +112,11 @@ Jobs::JobHandle InstallerLogic::InstallPlugin( { if(m_job) { - _E("Job is in progress. It is impossible to add new job"); + LogError("Job is in progress. It is impossible to add new job"); return -1; } - _D("New Plugin Installation"); + LogDebug("New Plugin Installation"); // TODO Conversion to PluginPath is temporary m_job = @@ -171,7 +170,8 @@ bool InstallerLogic::NextStep(Jobs::Job *job) return false; } catch (Jobs::JobExceptionBase &exc) { //start revert job - _D("Exception occured: %d. Reverting job...", exc.getParam()); + LogDebug("Exception occured: " << exc.getParam() << + ". Reverting job..."); bool hasAbortSteps = job->Abort(); job->SetAbortStarted(true); job->SaveExceptionData(exc); @@ -236,7 +236,8 @@ bool InstallerLogic::resolvePluginDependencies(PluginHandle handle) if (depHandle == Jobs::PluginInstall::JobPluginInstall::INVALID_HANDLE) { - _E("Library implementing: %ls NOT FOUND", (*requiredObject).c_str()); + LogError("Library implementing: " << + *requiredObject << " NOT FOUND"); //PluginDAO::SetPluginInstallationStatus(INSTALLATION_WAITING); return false; diff --git a/src/misc/feature_logic.cpp b/src/misc/feature_logic.cpp index ef0b495..7f928ef 100644 --- a/src/misc/feature_logic.cpp +++ b/src/misc/feature_logic.cpp @@ -22,9 +22,9 @@ #include #include #include +#include #include #include -#include namespace Jobs { namespace WidgetInstall { @@ -39,7 +39,7 @@ FeatureLogic::FeatureLogic(const WrtDB::TizenAppId & tzAppid) : WrtDB::WidgetDAOReadOnly widgetDao(tzAppid); WidgetFeatureSet featureSet = widgetDao.getFeaturesList(); FOREACH(it, featureSet) { - _D("Feature name : %ls", it->name.c_str()); + LogDebug("Feature name : " << it->name); WrtDB::DeviceCapabilitySet dcs; if (!DPL::StringCompare(it->name, PRIVILEGE_TESTAUTOMATION)) { // special privilege @@ -51,7 +51,7 @@ FeatureLogic::FeatureLogic(const WrtDB::TizenAppId & tzAppid) : dcs = WrtDB::GlobalDAOReadOnly::GetDeviceCapability(it->name); } FOREACH(devCap, dcs) { - _D("--- dev cap : %ls", (*devCap).c_str()); + LogDebug("--- dev cap : " << *devCap); } Feature feature(*it, dcs); m_featureList.push_back(feature); diff --git a/src/misc/libxml_utils.cpp b/src/misc/libxml_utils.cpp index 114e95b..852ab9a 100644 --- a/src/misc/libxml_utils.cpp +++ b/src/misc/libxml_utils.cpp @@ -21,7 +21,6 @@ #include "libxml_utils.h" #include -#include IMPLEMENT_SINGLETON(LibxmlUtils) @@ -31,7 +30,7 @@ LibxmlUtils::LibxmlUtils() : isInitialized(false) LibxmlUtils::~LibxmlUtils() { if (isInitialized) { - _D("Libxml - cleaning"); + LogDebug("Libxml - cleaning"); // Cleanup function for the XML library. xmlCleanupParser(); //this is to debug memory for regression tests @@ -44,8 +43,8 @@ void LibxmlUtils::init() if (!isInitialized) { LIBXML_TEST_VERSION isInitialized = true; - _D("Libxml have been initialized"); + LogDebug("Libxml have been initialized"); } - _D("Libxml already initialized"); + LogDebug("Libxml already initialized"); } diff --git a/src/misc/wac_widget_id.cpp b/src/misc/wac_widget_id.cpp index 23d7ad4..3fa621e 100644 --- a/src/misc/wac_widget_id.cpp +++ b/src/misc/wac_widget_id.cpp @@ -24,10 +24,10 @@ #include #include +#include #include #include -#include namespace { const char *SCHEME_HTTP = "http"; @@ -45,25 +45,26 @@ WacWidgetId::WacWidgetId(const DPL::OptionalString &widgetId) : bool WacWidgetId::matchHost(const DPL::String &second) const { - _D("m_schemaMatch is: %s", m_schemaMatch); + LogDebug("m_schemaMatch is: " << m_schemaMatch); if (!m_schemaMatch) { return false; } - _D("Matching DNS identity: %s %s", m_host.c_str(), DPL::ToUTF8String(second).c_str()); + LogDebug("Matching DNS identity: " << m_host << + " " << DPL::ToUTF8String(second)); return m_host == DPL::ToUTF8String(second); } void WacWidgetId::parse(const char *url) { - _D("Widget id to parse: %s", url); + LogDebug("Widget id to parse: " << url); std::unique_ptr > iri(iri_parse(url), iri_destroy); if (!iri.get()) { - _E("Error in parsing widget id."); + LogError("Error in parsing widget id."); return; // m_schemaMatch == false; } @@ -72,7 +73,7 @@ void WacWidgetId::parse(const char *url) if (iri.get()->scheme) { scheme = iri.get()->scheme; } else { - _W("Error. No scheme in widget id."); + LogWarning("Error. No scheme in widget id."); return; // m_schemaMatch == false; } @@ -82,7 +83,7 @@ void WacWidgetId::parse(const char *url) // We only match "http" and "https" schemas if ((scheme != SCHEME_HTTP) && (scheme != SCHEME_HTTPS)) { - _W("Unknown scheme in widget id. %s", scheme.c_str()); + LogWarning("Unknown scheme in widget id." << scheme); return; // m_schemaMatch == false; } else { m_schemaMatch = true; @@ -90,7 +91,7 @@ void WacWidgetId::parse(const char *url) if (iri.get()->host) { m_host = iri.get()->host; - _D("Host has been set to: %s", m_host.c_str()); + LogDebug("Host has been set to: " << m_host); } // What to do when host is empty? No info in wac documentation. diff --git a/src/misc/widget_install_to_external.cpp b/src/misc/widget_install_to_external.cpp index 62269cf..42bcc4f 100644 --- a/src/misc/widget_install_to_external.cpp +++ b/src/misc/widget_install_to_external.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include IMPLEMENT_SAFE_SINGLETON(WidgetInstallToExt) @@ -35,7 +35,7 @@ WidgetInstallToExt::~WidgetInstallToExt() void WidgetInstallToExt::initialize(std::string appId) { - _D("WidgetInstallToExt::initialize()"); + LogDebug("WidgetInstallToExt::initialize()"); m_appId = appId; m_handle = app2ext_init(APP2EXT_SD_CARD); @@ -46,7 +46,7 @@ void WidgetInstallToExt::initialize(std::string appId) void WidgetInstallToExt::deinitialize() { - _D("WidgetInstallToExt::deinitialize()"); + LogDebug("WidgetInstallToExt::deinitialize()"); if (NULL != m_handle) { if (0 < app2ext_deinit(m_handle)) { ThrowMsg(Exception::ErrorInstallToExt, @@ -58,13 +58,13 @@ void WidgetInstallToExt::deinitialize() void WidgetInstallToExt::preInstallation(GList *dirList, int dSize) { - _D("WidgetInstallToExt::preInstallation()"); + LogDebug("WidgetInstallToExt::preInstallation()"); Assert(m_handle); int ret = m_handle->interface.pre_install(m_appId.c_str(), dirList, dSize); if (APP2EXT_SUCCESS == ret) { - _D("App2Ext pre install success"); + LogDebug("App2Ext pre install success"); } else { postInstallation(false); ThrowMsg(Exception::ErrorInstallToExt, "pre-install failed"); @@ -73,7 +73,7 @@ void WidgetInstallToExt::preInstallation(GList *dirList, int dSize) void WidgetInstallToExt::postInstallation(bool status) { - _D("WidgetInstallToExt::postInstallation()"); + LogDebug("WidgetInstallToExt::postInstallation()"); if (NULL != m_handle) { if (status) { @@ -88,12 +88,12 @@ void WidgetInstallToExt::postInstallation(bool status) void WidgetInstallToExt::preUpgrade(GList *dirList, int dSize) { - _D("WidgetInstallToExt::preUpgrade()"); + LogDebug("WidgetInstallToExt::preUpgrade()"); Assert(m_handle); int ret = m_handle->interface.pre_upgrade(m_appId.c_str(), dirList, dSize); if (APP2EXT_SUCCESS == ret) { - _D("App2Ext pre-upgrade success"); + LogDebug("App2Ext pre-upgrade success"); } else { postUpgrade(false); ThrowMsg(Exception::ErrorInstallToExt, "pre-upgrade failed"); @@ -102,7 +102,7 @@ void WidgetInstallToExt::preUpgrade(GList *dirList, int dSize) void WidgetInstallToExt::postUpgrade(bool status) { - _D("WidgetInstallToExt::postUpgrade()"); + LogDebug("WidgetInstallToExt::postUpgrade()"); if (NULL != m_handle) { if (status) { m_handle->interface.post_upgrade(m_appId.c_str(), @@ -116,7 +116,7 @@ void WidgetInstallToExt::postUpgrade(bool status) void WidgetInstallToExt::uninstallation() { - _D("WidgetInstallToExt::uninstallation()"); + LogDebug("WidgetInstallToExt::uninstallation()"); Assert(m_handle); @@ -125,7 +125,7 @@ void WidgetInstallToExt::uninstallation() if (APP2EXT_SUCCESS == m_handle->interface.post_uninstall(m_appId.c_str())) { - _D("App2Ext pre-uninstall success"); + LogDebug("App2Ext pre-uninstall success"); } else { ThrowMsg(Exception::ErrorInstallToExt, "post-uninstall failed"); } diff --git a/src/misc/widget_location.cpp b/src/misc/widget_location.cpp index 8ab5fef..c43d9fb 100644 --- a/src/misc/widget_location.cpp +++ b/src/misc/widget_location.cpp @@ -23,10 +23,10 @@ #include #include #include +#include #include #include #include -#include WidgetLocation::DirectoryDeletor::DirectoryDeletor(bool isReadOnly) : m_dirpath(Jobs::WidgetInstall::createTempPath(isReadOnly)) @@ -38,9 +38,10 @@ WidgetLocation::DirectoryDeletor::DirectoryDeletor(std::string tempPath) : WidgetLocation::DirectoryDeletor::~DirectoryDeletor() { - _D("Removing widget installation temporary directory: %s", m_dirpath.c_str()); + LogDebug( + "Removing widget installation temporary directory: " << m_dirpath.c_str()); if (!WrtUtilRemove(m_dirpath)) { - _W("Fail at removing directory: %s", m_dirpath.c_str()); + LogWarning("Fail at removing directory: " << m_dirpath.c_str()); } } @@ -282,4 +283,4 @@ std::string WidgetLocation::getBackupSharedDataDir() const std::string WidgetLocation::getBackupSharedTrustedDir() const { return getBackupSharedDir() + "/trusted"; -} +} \ No newline at end of file diff --git a/src/pkg-manager/backendlib.cpp b/src/pkg-manager/backendlib.cpp index 495a787..40665f5 100644 --- a/src/pkg-manager/backendlib.cpp +++ b/src/pkg-manager/backendlib.cpp @@ -25,6 +25,7 @@ #include "package-manager-plugin.h" #include #include +#include #include #include #include @@ -33,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -47,7 +49,6 @@ #include "root_parser.h" #include "widget_parser.h" #include "parser_runner.h" -#include using namespace WrtDB; @@ -81,19 +82,19 @@ pkgmgr_info *pkgmgr_client_check_pkginfo_from_file(const char *pkg_path); static void pkg_native_plugin_on_unload() { - _D("pkg_native_plugin_unload() is called"); + LogDebug("pkg_native_plugin_unload() is called"); } static int pkg_plugin_app_is_installed(const char *pkg_name) { const char* REG_PKGID_PATTERN = "^[a-zA-Z0-9]{10}$"; - _D("pkg_plugin_app_is_installed() is called"); + LogDebug("pkg_plugin_app_is_installed() is called"); WrtDB::WrtDatabase::attachToThreadRO(); regex_t reg; if (regcomp(®, REG_PKGID_PATTERN, REG_NOSUB | REG_EXTENDED) != 0) { - _D("Regcomp failed"); + LogDebug("Regcomp failed"); } WrtDB::TizenAppId appid; @@ -101,14 +102,14 @@ static int pkg_plugin_app_is_installed(const char *pkg_name) if (!(regexec(®, pkg_name, static_cast(0), NULL, 0) == 0)) { - _E("Invalid argument : %s", pkg_name); + LogError("Invalid argument : " << pkg_name); return FALSE; } Try { WrtDB::TizenPkgId pkgid(DPL::FromUTF8String(pkg_name)); appid = WidgetDAOReadOnly::getTzAppId(pkgid); - _D("appid : %s", appid.c_str()); + LogDebug("appid : " << appid); } Catch(WidgetDAOReadOnly::Exception::WidgetNotExist) { WrtDB::WrtDatabase::detachFromThread(); return FALSE; @@ -122,7 +123,7 @@ static int pkg_plugin_get_installed_apps_list(const char * /*category*/, package_manager_pkg_info_t **list, int *count) { - _D("pkg_plugin_get_installed_apps_list() is called"); + LogDebug("pkg_plugin_get_installed_apps_list() is called"); package_manager_pkg_info_t *pkg_list = NULL; package_manager_pkg_info_t *pkg_last = NULL; @@ -170,7 +171,7 @@ static int pkg_plugin_get_app_detail_info( package_manager_pkg_detail_info_t * pkg_detail_info) { - _D("pkg_plugin_get_app_detail_info() is called"); + LogDebug("pkg_plugin_get_app_detail_info() is called"); WrtDB::WrtDatabase::attachToThreadRO(); @@ -178,7 +179,7 @@ static int pkg_plugin_get_app_detail_info( Try { WrtDB::TizenPkgId pkgid(DPL::FromUTF8String(pkg_name)); appid = WidgetDAOReadOnly::getTzAppId(pkgid); - _D("appid : %s", appid.c_str()); + LogDebug("appid : " << appid); } Catch(WidgetDAOReadOnly::Exception::WidgetNotExist) { WrtDB::WrtDatabase::detachFromThread(); return FALSE; @@ -202,7 +203,7 @@ static int pkg_plugin_get_app_detail_info( WidgetLocalizedInfo localizedInfo; if (locale.IsNull()) { - _D("locale is NULL"); + LogDebug("locale is NULL"); DPL::String languageTag(L""); localizedInfo = widget.getLocalizedInfo(languageTag); } else { @@ -286,32 +287,32 @@ int getConfigParserData(const std::string &widgetPath, ConfigParserData& configI } Catch(DPL::ZipInput::Exception::OpenFailed) { - _E("Failed to open widget package"); + LogError("Failed to open widget package"); return FALSE; } Catch(DPL::ZipInput::Exception::OpenFileFailed) { - _E("Failed to open config.xml file"); + LogError("Failed to open config.xml file"); return FALSE; } Catch(DPL::CopyFailed) { - _E("Failed to extract config.xml file"); + LogError("Failed to extract config.xml file"); return FALSE; } Catch(DPL::FileInput::Exception::OpenFailed) { - _E("Failed to open config.xml file"); + LogError("Failed to open config.xml file"); return FALSE; } Catch(ElementParser::Exception::ParseError) { - _E("Failed to parse config.xml file"); + LogError("Failed to parse config.xml file"); return FALSE; } Catch(DPL::ZipInput::Exception::SeekFileFailed) { - _E("Failed to seek widget archive - corrupted package?"); + LogError("Failed to seek widget archive - corrupted package?"); return FALSE; } @@ -332,7 +333,7 @@ char* getIconInfo(const std::string &widgetPath, } Catch(DPL::ZipInput::Exception::OpenFileFailed) { - _D("This web app is hybrid web app"); + LogDebug("This web app is hybrid web app"); std::string hybrid_icon = "res/wgt/" + icon_name; iconFile.reset(zipFile->OpenFile(hybrid_icon)); } @@ -348,12 +349,12 @@ char* getIconInfo(const std::string &widgetPath, } Catch(DPL::ZipInput::Exception::OpenFailed) { - _D("Failed to open widget package"); + LogDebug("Failed to open widget package"); return NULL; } Catch(DPL::ZipInput::Exception::OpenFileFailed) { - _D("Not found icon file %s", icon_name.c_str()); + LogDebug("Not found icon file " << icon_name); return NULL; } } @@ -500,7 +501,7 @@ int getWidgetDetailInfoFromPackage(const char* pkgPath, pkg_detail_info->privilege_list = NULL; FOREACH(it, configInfo.featuresList) { std::string featureInfo = DPL::ToUTF8String(it->name); - _D("privilege : %s", featureInfo.c_str()); + LogDebug("privilege : " << featureInfo); int length = featureInfo.size(); char *privilege = (char*) calloc(1, (sizeof(char) * (length + 1))); snprintf(privilege, length + 1, "%s", featureInfo.c_str()); @@ -511,10 +512,10 @@ int getWidgetDetailInfoFromPackage(const char* pkgPath, char* icon_buf = getIcon(widget_path, configInfo, pkg_detail_info->icon_size); if (icon_buf) { - _D("icon size : %d", pkg_detail_info->icon_size); + LogDebug("icon size : " << pkg_detail_info->icon_size); pkg_detail_info->icon_buf = icon_buf; } else { - _D("No icon"); + LogDebug("No icon"); pkg_detail_info->icon_size = 0; pkg_detail_info->icon_buf = NULL; } @@ -526,19 +527,19 @@ static int pkg_plugin_get_app_detail_info_from_package( const char * pkg_path, package_manager_pkg_detail_info_t * pkg_detail_info) { - _D("pkg_plugin_get_app_detail_info_from_package() is called"); + LogDebug("pkg_plugin_get_app_detail_info_from_package() is called"); return getWidgetDetailInfoFromPackage(pkg_path, pkg_detail_info); } pkgmgr_info *pkgmgr_client_check_pkginfo_from_file(const char *pkg_path) { - _D("pkgmgr_client_check_pkginfo_from_file() is called"); + LogDebug("pkgmgr_client_check_pkginfo_from_file() is called"); package_manager_pkg_detail_info_t *pkg_detail_info; pkg_detail_info = (package_manager_pkg_detail_info_t*)malloc( sizeof(package_manager_pkg_detail_info_t)); int ret = getWidgetDetailInfoFromPackage(pkg_path, pkg_detail_info); if (FALSE == ret) { - _E("Failed to get package detail info "); + LogError("Failed to get package detail info "); return NULL; } return reinterpret_cast(pkg_detail_info); diff --git a/src/pkg-manager/pkgmgr_signal.cpp b/src/pkg-manager/pkgmgr_signal.cpp index fb933e3..4d34368 100644 --- a/src/pkg-manager/pkgmgr_signal.cpp +++ b/src/pkg-manager/pkgmgr_signal.cpp @@ -19,9 +19,9 @@ * @brief */ +#include #include #include -#include namespace PackageManager { PkgmgrSignal::PkgmgrSignal() : @@ -36,14 +36,14 @@ PkgmgrSignal::~PkgmgrSignal() bool PkgmgrSignal::initialize(int argc, char* argv[]) { if (m_handle) { - _D("Release already allocated pkgmgr handle"); + LogDebug("Release already allocated pkgmgr handle"); pkgmgr_installer_free(m_handle); m_handle = NULL; } m_handle = pkgmgr_installer_new(); if (!m_handle) { - _E("Fail to get pkgmgr installer handle"); + LogError("Fail to get pkgmgr installer handle"); return false; } @@ -56,7 +56,7 @@ bool PkgmgrSignal::initialize(int argc, char* argv[]) m_reqType != PKGMGR_REQ_UNINSTALL && m_reqType != PKGMGR_REQ_REINSTALL) { - _E("Fail to get request type of pkgmgr"); + LogError("Fail to get request type of pkgmgr"); pkgmgr_installer_free(m_handle); m_handle = NULL; return false; @@ -66,7 +66,7 @@ bool PkgmgrSignal::initialize(int argc, char* argv[]) m_callerId = callerId; } else { - _E("Fail to get information of pkgmgr's request"); + LogError("Fail to get information of pkgmgr's request"); pkgmgr_installer_free(m_handle); m_handle = NULL; return false; @@ -80,7 +80,7 @@ bool PkgmgrSignal::initialize(int argc, char* argv[]) bool PkgmgrSignal::deinitialize() { if (!m_initialized) { - _E("PkgmgrSingal not yet intialized"); + LogError("PkgmgrSingal not yet intialized"); return false; } @@ -93,17 +93,17 @@ bool PkgmgrSignal::deinitialize() bool PkgmgrSignal::setPkgname(const std::string& name) { if (!m_initialized) { - _E("PkgmgrSingal not yet intialized"); + LogError("PkgmgrSingal not yet intialized"); return false; } if (name.empty()) { - _E("name is empty"); + LogError("name is empty"); return false; } m_pkgname = name; - _D("Success to set tizen package name: %s", m_pkgname.c_str()); + LogDebug("Success to set tizen package name: " << m_pkgname); return true; } @@ -112,17 +112,17 @@ bool PkgmgrSignal::sendSignal(const std::string& key, const std::string& value) const { if (!m_initialized) { - _E("PkgmgrSingal not yet intialized"); + LogError("PkgmgrSingal not yet intialized"); return false; } if (key.empty() || value.empty()) { - _D("key or value is empty"); + LogDebug("key or value is empty"); return false; } if (m_handle == NULL || m_type.empty()) { - _E("Some data of PkgmgrSignal is empty"); + LogError("Some data of PkgmgrSignal is empty"); return false; } @@ -131,18 +131,19 @@ bool PkgmgrSignal::sendSignal(const std::string& key, m_handle, m_type.c_str(), m_pkgname.c_str(), key.c_str(), value.c_str())) { - _E("Fail to send pkgmgr signal"); + LogError("Fail to send pkgmgr signal"); return false; } - _D("Success to send pkgmgr signal: %s - %s", key.c_str(), value.c_str()); + LogDebug("Success to send pkgmgr signal: " << key << + " - " << value); return true; } std::string PkgmgrSignal::getPkgname() const { if (!m_initialized) { - _E("PkgmgrSingal not yet intialized"); + LogError("PkgmgrSingal not yet intialized"); } return m_pkgname; @@ -151,7 +152,7 @@ std::string PkgmgrSignal::getPkgname() const int PkgmgrSignal::getRequestedType() const { if (!m_initialized) { - _E("PkgmgrSingal not yet intialized"); + LogError("PkgmgrSingal not yet intialized"); } return m_reqType; @@ -160,7 +161,7 @@ int PkgmgrSignal::getRequestedType() const std::string PkgmgrSignal::getCallerId() const { if (!m_initialized) { - _E("PkgmgrSingal not yet intialized"); + LogError("PkgmgrSingal not yet intialized"); } return m_callerId; diff --git a/src/wrt-installer/installer_callbacks_translate.cpp b/src/wrt-installer/installer_callbacks_translate.cpp index 5f93654..5e067e9 100644 --- a/src/wrt-installer/installer_callbacks_translate.cpp +++ b/src/wrt-installer/installer_callbacks_translate.cpp @@ -21,8 +21,7 @@ */ #include -#include -#include +#include namespace InstallerCallbacksTranslate { @@ -163,7 +162,7 @@ void installFinishedCallback(void *userParam, // Callback apiStr->status_callback(tizenId, errorStatus, apiStr->userdata); } else { - _D("installFinishedCallback: No callback"); + LogDebug("installFinishedCallback: No callback"); } } @@ -202,7 +201,7 @@ void uninstallFinishedCallback(void *userParam, // Callback apiStr->status_callback(tizenId, errorStatus, apiStr->userdata); } else { - _D("uninstallFinishedCallback: No callback"); + LogDebug("uninstallFinishedCallback: No callback"); } } @@ -232,7 +231,7 @@ void pluginInstallFinishedCallback(void *userParam, apiStr->statusCallback(errorStatus, apiStr->userdata); } else { - _D("PluginInstallFinishedCallback: No callback"); + LogDebug("PluginInstallFinishedCallback: No callback"); } delete apiStr; @@ -250,12 +249,12 @@ void installProgressCallback(void *userParam, if (apiStr->progress_callback) { //CALLBACK EXEC - _D("Entered %2.0f% %s", percent, description.c_str()); + LogPedantic("Entered " << percent << "% " << description); apiStr->progress_callback(static_cast(percent), description.c_str(), apiStr->userdata); } else { - _D("installProgressCallback: ignoring NULL callback pointer"); + LogPedantic("installProgressCallback: ignoring NULL callback pointer"); } } } //namespace diff --git a/src/wrt-installer/language_subtag_rst_tree.cpp b/src/wrt-installer/language_subtag_rst_tree.cpp index 9480466..291c67d 100644 --- a/src/wrt-installer/language_subtag_rst_tree.cpp +++ b/src/wrt-installer/language_subtag_rst_tree.cpp @@ -19,6 +19,7 @@ * @version 1.0 */ #include +#include #include #include #include @@ -28,8 +29,6 @@ #include #include #include -#include - IMPLEMENT_SINGLETON(LanguageSubtagRstTree) namespace I18nDAOReadOnly = I18n::DB::I18nDAOReadOnly; @@ -187,9 +186,10 @@ bool LanguageSubtagRstTree::ValidateLanguageTag(const std::string &tag_input) #define TEST_LANG(str, cond) \ if (LanguageSubtagRstTreeSingleton::Instance(). \ ValidateLanguageTag(str) == cond) { \ - _D("Good validate status for lang: %s", str); \ + LogDebug("Good validate status for lang: " << str); \ } else { \ - _E("Wrong validate status for lang: %s, should be %s", str, cond); \ + LogError("Wrong validate status for lang: " << str \ + << ", should be " << cond); \ } void LanguageSubtagRstTree::Initialize() diff --git a/src/wrt-installer/plugin_utils.cpp b/src/wrt-installer/plugin_utils.cpp index cabda19..657f8dc 100644 --- a/src/wrt-installer/plugin_utils.cpp +++ b/src/wrt-installer/plugin_utils.cpp @@ -23,9 +23,9 @@ #include #include "plugin_utils.h" #include +#include #include #include -#include using namespace WrtDB; @@ -43,13 +43,13 @@ bool lockPluginInstallation(bool isPreload) int ret = 0; - _D("Try to lock for plugins installation."); + LogDebug("Try to lock for plugins installation."); s_plugin_install_lock_fd = open(PLUGIN_INSTALL_LOCK_FILE, O_RDONLY | O_CREAT, 0666); if (s_plugin_install_lock_fd == -1) { - _E("Lock file open failed!"); + LogError("Lock file open failed!"); return false; } @@ -57,7 +57,7 @@ bool lockPluginInstallation(bool isPreload) ret = flock(s_plugin_install_lock_fd, LOCK_EX); //lock with waiting if (ret == -1) { - _E("Lock failed!"); + LogError("Lock failed!"); close(s_plugin_install_lock_fd); s_plugin_install_lock_fd = -1; @@ -70,7 +70,7 @@ bool lockPluginInstallation(bool isPreload) bool unlockPluginInstallation(bool isPreload) { - _D("Unlock for plugins installation."); + LogDebug("Unlock for plugins installation."); if (isPreload) { fprintf(stderr, "Skip plugin unlock.. \n"); return true; @@ -82,7 +82,7 @@ bool unlockPluginInstallation(bool isPreload) ret = flock(s_plugin_install_lock_fd, LOCK_UN); //unlock if (ret == -1) { - _E("Unlock failed!"); + LogError("Unlock failed!"); } close(s_plugin_install_lock_fd); @@ -90,7 +90,7 @@ bool unlockPluginInstallation(bool isPreload) return true; } else { - _E("Lock file was not created!"); + LogError("Lock file was not created!"); } return false; @@ -110,7 +110,7 @@ bool checkPluginInstallationRequired() case FileState::FILE_NOT_EXISTS: return false; default: - _W("Opening installation request file failed"); + LogWarning("Opening installation request file failed"); return false; } } diff --git a/src/wrt-installer/wrt-installer.cpp b/src/wrt-installer/wrt-installer.cpp index 7346816..30295d0 100644 --- a/src/wrt-installer/wrt-installer.cpp +++ b/src/wrt-installer/wrt-installer.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -47,7 +48,6 @@ #include #include -#include using namespace WrtDB; @@ -87,12 +87,12 @@ WrtInstaller::WrtInstaller(int argc, char **argv) : m_startupPluginInstallation(false) { Touch(); - _D("App Created"); + LogDebug("App Created"); } WrtInstaller::~WrtInstaller() { - _D("App Finished"); + LogDebug("App Finished"); } int WrtInstaller::getReturnStatus() const @@ -102,12 +102,12 @@ int WrtInstaller::getReturnStatus() const void WrtInstaller::OnStop() { - _D("Stopping Dummy Client"); + LogDebug("Stopping Dummy Client"); } void WrtInstaller::OnCreate() { - _D("Creating DummyClient"); + LogDebug("Creating DummyClient"); showArguments(); AddStep(&WrtInstaller::initStep); @@ -148,7 +148,7 @@ void WrtInstaller::OnCreate() if (!m_startupPluginInstallation) { AddStep(&WrtInstaller::installPluginsStep); } else { - _D("Plugin installation alredy started"); + LogDebug("Plugin installation alredy started"); } } else if (arg == "-i" || arg == "--install") { if (m_argc != 3) { @@ -157,17 +157,17 @@ void WrtInstaller::OnCreate() struct stat info; if (-1 != stat(m_argv[2], &info) && S_ISDIR(info.st_mode)) { - _D("Installing package directly from directory"); + LogDebug("Installing package directly from directory"); m_installMode.extension = InstallMode::ExtensionType::DIR; } else { - _D("Installing from regular location"); + LogDebug("Installing from regular location"); m_installMode.extension = InstallMode::ExtensionType::WGT; } m_packagePath = m_argv[2]; AddStep(&WrtInstaller::installStep); } else if (arg == "-ip" || arg == "--install-preload") { - _D("Install preload web app"); + LogDebug("Install preload web app"); if (m_argc != 3) { return showHelpAndQuit(); } @@ -176,7 +176,7 @@ void WrtInstaller::OnCreate() m_installMode.rootPath = InstallMode::RootPath::RO; AddStep(&WrtInstaller::installStep); } else if (arg == "-ipw" || arg == "--install-preload-writable") { - _D("Install preload web application to writable storage"); + LogDebug("Install preload web application to writable storage"); if (m_argc != 3) { return showHelpAndQuit(); } @@ -186,7 +186,7 @@ void WrtInstaller::OnCreate() AddStep(&WrtInstaller::installStep); } else if (arg == "-c" || arg == "--csc-update") { // "path=/opt/system/csc/Ozq2iEG15R-2.0.0-arm.wgt:op=install:removable=true" - _D("Install & uninstall by csc configuration"); + LogDebug("Install & uninstall by csc configuration"); if (m_argc != 3) { return showHelpAndQuit(); } @@ -201,7 +201,7 @@ void WrtInstaller::OnCreate() } if (it->second == CSCConfiguration::VALUE_INSTALL) { - _D("operation = %s", it->second.c_str()); + LogDebug("operation = " << it->second); m_installMode.extension = InstallMode::ExtensionType::WGT; it = m_CSCconfigurationMap.find(CSCConfiguration::KEY_PATH); if (it == m_CSCconfigurationMap.end()) { @@ -220,9 +220,9 @@ void WrtInstaller::OnCreate() ? false : true; AddStep(&WrtInstaller::installStep); - _D("path = %s", m_packagePath.c_str()); + LogDebug("path = " << m_packagePath); } else if (it->second == CSCConfiguration::VALUE_UNINSTALL) { - _D("operation = %s", it->second.c_str()); + LogDebug("operation = " << it->second); // uninstall command isn't confirmed yet it = m_CSCconfigurationMap.find(CSCConfiguration::KEY_PATH); if (it == m_CSCconfigurationMap.end()) { @@ -230,11 +230,11 @@ void WrtInstaller::OnCreate() } m_packagePath = it->second; AddStep(&WrtInstaller::unistallWgtFileStep); - _D("operation = uninstall"); - _D("path = %s", m_packagePath.c_str()); + LogDebug("operation = uninstall"); + LogDebug("path = " << m_packagePath); } else { - _E("Unknown operation : %s", it->second.c_str()); - _D("operation = %s", it->second.c_str()); + LogError("Unknown operation : " << it->second); + LogDebug("operation = " << it->second); return showHelpAndQuit(); } } else if (arg == "-un" || arg == "--uninstall-name") { @@ -253,7 +253,7 @@ void WrtInstaller::OnCreate() if (m_argc != 3) { return showHelpAndQuit(); } - _D("Installing package directly from directory"); + LogDebug("Installing package directly from directory"); m_installMode.command = InstallMode::Command::REINSTALL; m_installMode.extension = InstallMode::ExtensionType::DIR; m_packagePath = m_argv[2]; @@ -281,10 +281,10 @@ void WrtInstaller::OnCreate() m_packagePath = m_argv[4]; struct stat info; if (-1 != stat(m_argv[4], &info) && S_ISDIR(info.st_mode)) { - _D("Installing package directly from directory"); + LogDebug("Installing package directly from directory"); m_installMode.extension = InstallMode::ExtensionType::DIR; } else { - _D("Installing from regular location"); + LogDebug("Installing from regular location"); m_installMode.extension = InstallMode::ExtensionType::WGT; } AddStep(&WrtInstaller::installStep); @@ -298,15 +298,16 @@ void WrtInstaller::OnCreate() if (0 == pkgmgrinfo_pkginfo_get_pkginfo(m_name.c_str(), &handle)) { if (0 > pkgmgrinfo_pkginfo_is_system(handle, &system_app)) { - _E("Can't get package information : %s", m_name.c_str()); + LogError("Can't get package information : " << m_name); } if (0 > pkgmgrinfo_pkginfo_is_update(handle, &update)) { - _E("Can't get package information about update : %s", m_name.c_str()); + LogError("Can't get package information about update : " + << m_name); } } - _D("system app : %d", system_app); - _D("update : %d", update); + LogDebug("system app : " << system_app); + LogDebug("update : " << update); if (system_app && update) { AddStep(&WrtInstaller::removeUpdateStep); @@ -322,7 +323,7 @@ void WrtInstaller::OnCreate() AddStep(&WrtInstaller::installStep); break; default: - _D("Not available type"); + LogDebug("Not available type"); break; } } @@ -335,12 +336,12 @@ void WrtInstaller::OnCreate() void WrtInstaller::OnReset(bundle* /*b*/) { - _D("OnReset"); + LogDebug("OnReset"); } void WrtInstaller::OnTerminate() { - _D("Wrt Shutdown now"); + LogDebug("Wrt Shutdown now"); PluginUtils::unlockPluginInstallation( m_installMode.installTime == InstallMode::InstallTime::PRELOAD); if (m_initialized) { @@ -387,28 +388,28 @@ void WrtInstaller::showArguments() fprintf(stderr, "===========================================================\n"); // for dlog - _D("==========================================================="); - _D("# wrt-installer #"); - _D("# argc %d", m_argc); + LogDebug("==========================================================="); + LogDebug("# wrt-installer #"); + LogDebug("# argc " << m_argc); for (int i = 0; i < m_argc; i++) { - _D("# argv[%d] = %s", i, m_argv[i]); + LogDebug("# argv[" << i << "] = " << m_argv[i]); } - _D("==========================================================="); + LogDebug("==========================================================="); } void WrtInstaller::OnEventReceived(const WRTInstallerNS::QuitEvent& /*event*/) { - _D("Quiting"); + LogDebug("Quiting"); if (m_initialized) { - _D("Wrt Shutdown now"); + LogDebug("Wrt Shutdown now"); SwitchToStep(&WrtInstaller::shutdownStep); DPL::Event::ControllerEventHandler:: PostEvent( WRTInstallerNS::NextStepEvent()); } else { - _D("Quiting application"); + LogDebug("Quiting application"); return Quit(); } } @@ -416,7 +417,7 @@ void WrtInstaller::OnEventReceived(const WRTInstallerNS::QuitEvent& /*event*/) void WrtInstaller::OnEventReceived( const WRTInstallerNS::NextStepEvent& /*event*/) { - _D("Executing next step"); + LogDebug("Executing next step"); NextStep(); } @@ -446,7 +447,7 @@ void WrtInstaller::initStep() void WrtInstaller::installStep() { - _D("Installing widget ..."); + LogDebug("Installing widget ..."); std::unique_ptr packagePath(canonicalize_file_name( m_packagePath.c_str())); @@ -460,15 +461,15 @@ void WrtInstaller::installStep() void WrtInstaller::installPluginsStep() { - _D("Installing plugins ..."); + LogDebug("Installing plugins ..."); fprintf(stderr, "Installing plugins ...\n"); if (m_startupPluginInstallation) { - _D("Plugin installation started because new plugin package found"); + LogDebug("Plugin installation started because new plugin package found"); } else if (!PluginUtils::lockPluginInstallation( m_installMode.installTime == InstallMode::InstallTime::PRELOAD)) { - _E("Failed to open plugin installation lock file" + LogError("Failed to open plugin installation lock file" " Plugins are currently installed by other process"); staticWrtPluginInstallationCallback(WRT_INSTALLER_ERROR_PLUGIN_INSTALLATION_FAILED, this); @@ -484,7 +485,7 @@ void WrtInstaller::installPluginsStep() return; } - _D("Plugin DIRECTORY IS %s", PLUGIN_PATH.c_str()); + LogDebug("Plugin DIRECTORY IS" << PLUGIN_PATH); std::list pluginsPaths; struct dirent libdir; @@ -508,12 +509,12 @@ void WrtInstaller::installPluginsStep() struct stat tmp; if (stat(path.c_str(), &tmp) == -1) { - _E("Failed to open file %s", path.c_str()); + LogError("Failed to open file" << path); continue; } if (!S_ISDIR(tmp.st_mode)) { - _E("Not a directory %s", path.c_str()); + LogError("Not a directory" << path); continue; } @@ -521,13 +522,13 @@ void WrtInstaller::installPluginsStep() } if (return_code != 0 || errno != 0) { - _E("readdir_r() failed with %ls", DPL::GetErrnoString().c_str()); + LogError("readdir_r() failed with " << DPL::GetErrnoString()); } //set nb of plugins to install //this value indicate how many callbacks are expected m_numPluginsToInstall = pluginsPaths.size(); - _D("Plugins to install: %d", m_numPluginsToInstall); + LogDebug("Plugins to install: " << m_numPluginsToInstall); m_pluginsPaths = pluginsPaths; m_totalPlugins = m_numPluginsToInstall; @@ -535,14 +536,15 @@ void WrtInstaller::installPluginsStep() ::PostEvent(WRTInstallerNS::InstallPluginEvent()); if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) { - _E("Failed to close dir: %s with error: %ls", PLUGIN_PATH.c_str(), DPL::GetErrnoString().c_str()); + LogError("Failed to close dir: " << PLUGIN_PATH << " with error: " + << DPL::GetErrnoString()); } } void WrtInstaller::uninstallPkgNameStep() { - _D("Uninstalling widget ..."); - _D("Package name : %s", m_name.c_str()); + LogDebug("Uninstalling widget ..."); + LogDebug("Package name : " << m_name); wrt_uninstall_widget(m_name.c_str(), this, &staticWrtStatusCallback, @@ -553,8 +555,8 @@ void WrtInstaller::uninstallPkgNameStep() void WrtInstaller::removeUpdateStep() { - _D("This web app need to initialize preload app"); - _D("Package name : %s", m_name.c_str()); + LogDebug("This web app need to initialize preload app"); + LogDebug("Package name : " << m_name); wrt_uninstall_widget(m_name.c_str(), this, &staticWrtInitializeToPreloadCallback, @@ -566,7 +568,7 @@ void WrtInstaller::removeUpdateStep() void WrtInstaller::unistallWgtFileStep() { - _D("Uninstalling widget ..."); + LogDebug("Uninstalling widget ..."); Try { // Parse config @@ -601,14 +603,14 @@ void WrtInstaller::unistallWgtFileStep() DPL::OptionalString pkgId = configInfo.tizenPkgId; if (!pkgId.IsNull()) { - _D("Pkgid from packagePath : %ls", (*pkgId).c_str()); + LogDebug("Pkgid from packagePath : " << pkgId); wrt_uninstall_widget( DPL::ToUTF8String(*pkgId).c_str(), this, &staticWrtStatusCallback, !m_installByPkgmgr ? &staticWrtUninstallProgressCallback : NULL, pkgmgrSignalInterface); } else { - _E("Fail to uninstalling widget... "); + LogError("Fail to uninstalling widget... "); m_returnStatus = -1; DPL::Event::ControllerEventHandler:: PostEvent( @@ -617,7 +619,7 @@ void WrtInstaller::unistallWgtFileStep() } Catch(DPL::ZipInput::Exception::OpenFailed) { - _E("Failed to open widget package"); + LogError("Failed to open widget package"); printf("failed: widget package does not exist\n"); m_returnStatus = -1; DPL::Event::ControllerEventHandler:: @@ -627,7 +629,7 @@ void WrtInstaller::unistallWgtFileStep() Catch(DPL::ZipInput::Exception::OpenFileFailed) { printf("failed: widget config file does not exist\n"); - _E("Failed to open config.xml file"); + LogError("Failed to open config.xml file"); m_returnStatus = -1; DPL::Event::ControllerEventHandler:: PostEvent( @@ -636,7 +638,7 @@ void WrtInstaller::unistallWgtFileStep() Catch(ElementParser::Exception::ParseError) { printf("failed: can not parse config file\n"); - _E("Failed to parse config.xml file"); + LogError("Failed to parse config.xml file"); m_returnStatus = -1; DPL::Event::ControllerEventHandler:: PostEvent( @@ -646,7 +648,7 @@ void WrtInstaller::unistallWgtFileStep() void WrtInstaller::shutdownStep() { - _D("Closing Wrt connection ..."); + LogDebug("Closing Wrt connection ..."); if (m_initialized) { wrt_installer_shutdown(); m_initialized = false; @@ -663,14 +665,14 @@ void WrtInstaller::staticWrtInitCallback(WrtErrStatus status, Assert(This); if (status == WRT_SUCCESS) { - _D("Init succesfull"); + LogDebug("Init succesfull"); This->m_initialized = true; This->m_returnStatus = 0; This->DPL::Event::ControllerEventHandler ::PostEvent(WRTInstallerNS::NextStepEvent()); } else { - _E("Init unsuccesfull"); + LogError("Init unsuccesfull"); This->m_returnStatus = -1; This->DPL::Event::ControllerEventHandler:: PostEvent( @@ -688,7 +690,7 @@ void WrtInstaller::staticWrtInitializeToPreloadCallback(std::string tizenId, Wrt if (WRT_SUCCESS != status) { // Failure - _E("Step failed"); + LogError("Step failed"); This->m_returnStatus = 1; This->showErrorMsg(status, tizenId, printMsg); @@ -724,7 +726,7 @@ void WrtInstaller::staticWrtInitPreloadStatusCallback(std::string tizenId, if (WRT_SUCCESS != status) { // Failure - _E("Step failed"); + LogError("Step failed"); This->m_returnStatus = status; This->showErrorMsg(status, tizenId, printMsg); @@ -736,7 +738,7 @@ void WrtInstaller::staticWrtInitPreloadStatusCallback(std::string tizenId, "## wrt-installer : %s %s was successful.\n", tizenId.c_str(), printMsg.c_str()); - _D("Status succesfull"); + LogDebug("Status succesfull"); This->m_returnStatus = 0; resultMsg += L" : " + DPL::FromUTF8String(PKGMGR_END_SUCCESS); @@ -769,7 +771,7 @@ void WrtInstaller::staticWrtStatusCallback(std::string tizenId, if (WRT_SUCCESS != status) { // Failure - _E("Step failed"); + LogError("Step failed"); This->m_returnStatus = status; This->DPL::Event::ControllerEventHandler @@ -781,16 +783,17 @@ void WrtInstaller::staticWrtStatusCallback(std::string tizenId, "## wrt-installer : %s %s was successful.\n", tizenId.c_str(), printMsg.c_str()); - _D("Status succesfull"); + LogDebug("Status succesfull"); This->m_returnStatus = 0; resultMsg += L" : " + DPL::FromUTF8String(PKGMGR_END_SUCCESS); if (This->m_installMode.installTime == InstallMode::InstallTime::PRELOAD && !This->m_packagePath.empty()) { - _D("This widget is preloaded so it will be removed : %s", This->m_packagePath.c_str()); + LogDebug("This widget is preloaded so it will be removed : " + << This->m_packagePath); if (!WrtUtilRemove(This->m_packagePath)) { - _E("Failed to remove %s", This->m_packagePath.c_str()); + LogError("Failed to remove " << This->m_packagePath); } } @@ -989,22 +992,22 @@ void WrtInstaller::staticWrtPluginInstallationCallback(WrtErrStatus status, delete data; This->m_numPluginsToInstall--; - _D("Plugins to install: %d", This->m_numPluginsToInstall); + LogDebug("Plugins to install: " << This->m_numPluginsToInstall); if (This->m_numPluginsToInstall < 1) { - _D("All plugins installation completed"); + LogDebug("All plugins installation completed"); fprintf(stderr, "All plugins installation completed.\n"); //remove installation request if (!PluginUtils::removeInstallationRequiredFlag()) { - _D("Failed to remove file initializing plugin installation"); + LogDebug("Failed to remove file initializing plugin installation"); } //remove lock file if (!PluginUtils::unlockPluginInstallation( This->m_installMode.installTime == InstallMode::InstallTime::PRELOAD)) { - _D("Failed to remove installation lock"); + LogDebug("Failed to remove installation lock"); } This->DPL::Event::ControllerEventHandler @@ -1021,20 +1024,20 @@ void WrtInstaller::staticWrtPluginInstallationCallback(WrtErrStatus status, fprintf(stderr, "## wrt-installer : plugin installation successfull [%s]\n", path.c_str()); - _D("One plugin Installation succesfull: %s", path.c_str()); + LogDebug("One plugin Installation succesfull: " << path); return; } // Failure - _W("One of the plugins installation failed!: %s", path.c_str()); + LogWarning("One of the plugins installation failed!: " << path); switch (status) { case WRT_INSTALLER_ERROR_PLUGIN_INSTALLATION_FAILED: - _E("failed: plugin installation failed\n"); + LogError("failed: plugin installation failed\n"); break; case WRT_INSTALLER_ERROR_UNKNOWN: - _E("failed: unknown error\n"); + LogError("failed: unknown error\n"); break; default: @@ -1050,7 +1053,9 @@ void WrtInstaller::staticWrtPluginInstallProgressCb(float percent, std::string path = std::string(data->pluginPath); - _D("Plugin Installation: %s progress: %2.0f description: %s", path.c_str(), percent, description); + LogDebug("Plugin Installation: " << path << + " progress: " << percent << + "description " << description); } void WrtInstaller::staticWrtInstallProgressCallback(float percent, @@ -1058,14 +1063,16 @@ void WrtInstaller::staticWrtInstallProgressCallback(float percent, void* /*userdata*/) { //WrtInstaller *This = static_cast(userdata); - _D(" progress: %2.0f description: %s", percent, description); + LogDebug(" progress: " << percent << + " description: " << description); } void WrtInstaller::staticWrtUninstallProgressCallback(float percent, const char* description, void* /*userdata*/) { //WrtInstaller *This = static_cast(userdata); - _D(" progress: %2.0f description: %s", percent, description); + LogDebug(" progress: " << percent << + " description: " << description); } void WrtInstaller::showResultCallback(void *data, Evas_Object* /*obj*/, @@ -1090,17 +1097,17 @@ void WrtInstaller::failResultCallback(void *data, Evas_Object* /*obj*/, void WrtInstaller::installNewPlugins() { - _D("Install new plugins"); + LogDebug("Install new plugins"); if (!PluginUtils::lockPluginInstallation( m_installMode.installTime == InstallMode::InstallTime::PRELOAD)) { - _D("Lock NOT created"); + LogDebug("Lock NOT created"); return; } if (!PluginUtils::checkPluginInstallationRequired()) { - _D("Plugin installation not required"); + LogDebug("Plugin installation not required"); PluginUtils::unlockPluginInstallation( m_installMode.installTime == InstallMode::InstallTime::PRELOAD); return; @@ -1115,11 +1122,11 @@ CSCConfiguration::dataMap WrtInstaller::parseCSCConfiguration( { // path=/opt/system/csc/Ozq2iEG15R-2.0.0-arm.wgt:op=install:removable=true // parsing CSC configuration string - _D("parseConfiguration"); + LogDebug("parseConfiguration"); CSCConfiguration::dataMap result; if (str.empty()) { - _D("Input argument is empty"); + LogDebug("Input argument is empty"); return result; } @@ -1157,25 +1164,25 @@ int main(int argc, char *argv[]) // Check and re-set the file open limitation struct rlimit rlim; if (getrlimit(RLIMIT_NOFILE, &rlim) != -1) { - _D("RLIMIT_NOFILE sft(%d)", rlim.rlim_cur); - _D("RLIMIT_NOFILE hrd(%d)", rlim.rlim_max); + LogDebug("RLIMIT_NOFILE sft(" << rlim.rlim_cur << ")"); + LogDebug("RLIMIT_NOFILE hrd(" << rlim.rlim_max << ")"); if (rlim.rlim_cur < NOFILE_CNT_FOR_INSTALLER) { rlim.rlim_cur = NOFILE_CNT_FOR_INSTALLER; rlim.rlim_max = NOFILE_CNT_FOR_INSTALLER; if (setrlimit(RLIMIT_NOFILE, &rlim) == -1) { - _E("setrlimit is fail!!"); + LogError("setrlimit is fail!!"); } } } else { - _E("getrlimit is fail!!"); + LogError("getrlimit is fail!!"); } WrtInstaller app(argc, argv); int ret = app.Exec(); - _D("App returned: %d", ret); + LogDebug("App returned: " << ret); ret = app.getReturnStatus(); - _D("WrtInstaller returned: %d", ret); + LogDebug("WrtInstaller returned: " << ret); return ret; } UNHANDLED_EXCEPTION_HANDLER_END diff --git a/src/wrt-installer/wrt_installer_api.cpp b/src/wrt-installer/wrt_installer_api.cpp index cc2c84a..e9f1aca 100644 --- a/src/wrt-installer/wrt_installer_api.cpp +++ b/src/wrt-installer/wrt_installer_api.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -44,7 +45,6 @@ #include #include #include -#include using namespace WrtDB; @@ -64,7 +64,7 @@ static bool checkPath(const std::string& path) if (0 == stat(path.c_str(), &st) && S_ISDIR(st.st_mode)) { return true; } - _E("Cannot access directory [ %s ]", path.c_str()); + LogError("Cannot access directory [ " << path << " ]"); return false; } @@ -84,8 +84,8 @@ void wrt_installer_init(void *userdata, WrtInstallerInitCallback callback) { try { - _D("[WRT-API] INITIALIZING WRT INSTALLER..."); - _D("[WRT-API] BUILD: %s", __TIMESTAMP__); + LogDebug("[WRT-API] INITIALIZING WRT INSTALLER..."); + LogDebug("[WRT-API] BUILD: " << __TIMESTAMP__); // Touch InstallerController Singleton InstallerMainThreadSingleton::Instance().TouchArchitecture(); @@ -106,7 +106,7 @@ void wrt_installer_init(void *userdata, InstallerMainThreadSingleton::Instance().AttachDatabases(); - _D("Prepare libxml2 to work in multithreaded program."); + LogDebug("Prepare libxml2 to work in multithreaded program."); xmlInitParser(); // // Initialize Language Subtag registry @@ -119,11 +119,11 @@ void wrt_installer_init(void *userdata, InitializeEvent()); if (callback) { - _D("[WRT-API] WRT INSTALLER INITIALIZATION CALLBACK"); + LogDebug("[WRT-API] WRT INSTALLER INITIALIZATION CALLBACK"); callback(WRT_SUCCESS, userdata); } } catch (const DPL::Exception& ex) { - _E("Internal Error during Init:"); + LogError("Internal Error during Init:"); DPL::Exception::DisplayKnownException(ex); if (callback) { callback(WRT_INSTALLER_ERROR_FATAL_ERROR, userdata); @@ -136,7 +136,7 @@ void wrt_installer_init(void *userdata, void wrt_installer_shutdown() { try { - _D("[WRT-API] DEINITIALIZING WRT INSTALLER..."); + LogDebug("[WRT-API] DEINITIALIZING WRT INSTALLER..."); // Installer termination CONTROLLER_POST_SYNC_EVENT( @@ -150,10 +150,10 @@ void wrt_installer_shutdown() ValidationCore::VCoreDeinit(); // Global deinit check - _D("Cleanup libxml2 global values."); + LogDebug("Cleanup libxml2 global values."); xmlCleanupParser(); } catch (const DPL::Exception& ex) { - _E("Internal Error during Shutdown:"); + LogError("Internal Error during Shutdown:"); DPL::Exception::DisplayKnownException(ex); } } @@ -177,7 +177,7 @@ void wrt_install_widget( DPL::Log::LogSystemSingleton::Instance().AddProvider(oldStyleProvider); } - _D("[WRT-API] INSTALL WIDGET: %s", path); + LogDebug("[WRT-API] INSTALL WIDGET: " << path); // Post installation event CONTROLLER_POST_EVENT( Logic::InstallerController, @@ -204,7 +204,7 @@ void wrt_uninstall_widget( UNHANDLED_EXCEPTION_HANDLER_BEGIN { std::string tizenAppid(tzAppid); - _D("[WRT-API] UNINSTALL WIDGET: %s", tizenAppid.c_str()); + LogDebug("[WRT-API] UNINSTALL WIDGET: " << tizenAppid); // Post uninstallation event CONTROLLER_POST_EVENT( Logic::InstallerController, @@ -231,7 +231,7 @@ void wrt_install_plugin( { UNHANDLED_EXCEPTION_HANDLER_BEGIN { - _D("[WRT-API] INSTALL PLUGIN: %s", pluginDir); + LogDebug("[WRT-API] INSTALL PLUGIN: " << pluginDir); //Private data for status callback //Resource is free in pluginInstallFinishedCallback InstallerCallbacksTranslate::PluginStatusCallbackStruct* diff --git a/tests/general/InstallerWrapper.cpp b/tests/general/InstallerWrapper.cpp index de98a3f..71b0382 100644 --- a/tests/general/InstallerWrapper.cpp +++ b/tests/general/InstallerWrapper.cpp @@ -16,7 +16,7 @@ #include "InstallerWrapper.h" -#include +#include #include @@ -39,7 +39,7 @@ std::string getAndCutInstallerLogLine(std::string &src) size_t startIndex = src.find(INSTALLER_MESSSGE_START); if (startIndex == std::string::npos) { - _W("Installer message can not be found"); + LogWarning("Installer message can not be found"); return std::string(); } size_t newLineIndex = src.find("\n", startIndex); @@ -76,7 +76,7 @@ InstallResult install( { msg += buffer; } - _D("%s", msg.c_str()); + LogDebug(msg); auto err = pclose(filehandle); if (!WIFEXITED(err)) { return OtherError; @@ -94,7 +94,7 @@ InstallResult install( int nr = sscanf(line.c_str(), INSTALLER_MESSAGE_ID_LINE_FAIL.c_str(), id); if (1 != nr) { - _W("Can not read widget ID from message: %s", line.c_str()); + LogWarning("Can not read widget ID from message: " << line); delete[] id; return OtherError; } @@ -118,7 +118,7 @@ InstallResult install( if (1 != nr) { - _W("Can not read widget ID from message: %s", line.c_str()); + LogWarning("Can not read widget ID from message: " << line); delete[] id; return OtherError; } @@ -137,7 +137,7 @@ InstallResult install( bool uninstall(const std::string& tizenId) { std::string cmd = uninstallCmd + tizenId + " > /dev/null 2>/dev/null"; - _D("executing: %s", cmd.c_str()); + LogDebug("executing: " << cmd); return (system(cmd.c_str()) == EXIT_SUCCESS); } diff --git a/tests/general/ManifestFile.cpp b/tests/general/ManifestFile.cpp index 5c2c1ce..e88a507 100644 --- a/tests/general/ManifestFile.cpp +++ b/tests/general/ManifestFile.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include //TODO: This file reads manifest file. This functionality is familiar with writing // in wrt-installer but reading ws not necessary there. diff --git a/tests/general/ManifestTests.cpp b/tests/general/ManifestTests.cpp index 3ebc087..6b76d3a 100644 --- a/tests/general/ManifestTests.cpp +++ b/tests/general/ManifestTests.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include using namespace InstallerWrapper; @@ -60,46 +60,46 @@ RUNNER_TEST(creatingManifestFile) Try { - _D("Package %s", mf.getValueByXpath("/p:manifest/@package").c_str()); + LogDebug("Package " << mf.getValueByXpath("/p:manifest/@package")); RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/@package") == tizenId.substr(0,10)); - _D("type %s", mf.getValueByXpath("/p:manifest/@type").c_str()); + LogDebug("type " << mf.getValueByXpath("/p:manifest/@type")); RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/@type") == "wgt"); - _D("version %s", mf.getValueByXpath("/p:manifest/@version").c_str()); + LogDebug("version " << mf.getValueByXpath("/p:manifest/@version")); RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/@version") == "1.0"); - _D("label %s", mf.getValueByXpath("/p:manifest/p:label").c_str()); + LogDebug("label " << mf.getValueByXpath("/p:manifest/p:label")); RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:label") == "Manifest Example"); - _D("email %s", mf.getValueByXpath("/p:manifest/p:author/@email").c_str()); + LogDebug("email " << mf.getValueByXpath("/p:manifest/p:author/@email")); RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:author/@email") == "manifest@misc.test.create.desktop.com"); - _D("href %s", mf.getValueByXpath("/p:manifest/p:author/@href").c_str()); + LogDebug("href " << mf.getValueByXpath("/p:manifest/p:author/@href")); RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:author/@href") == "http://misc.test.create.desktop.com"); - _D("author %s", mf.getValueByXpath("/p:manifest/p:author").c_str()); + LogDebug("author " << mf.getValueByXpath("/p:manifest/p:author")); RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:author") == "Manifest"); - _D("appid %s", mf.getValueByXpath("/p:manifest/p:ui-application/@appid").c_str()); + LogDebug("appid " << mf.getValueByXpath("/p:manifest/p:ui-application/@appid")); RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/@appid") == tizenId); - _D("nodisplay %s", mf.getValueByXpath("/p:manifest/p:ui-application/@nodisplay").c_str()); + LogDebug("nodisplay " << mf.getValueByXpath("/p:manifest/p:ui-application/@nodisplay")); RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/@nodisplay") == "false"); - _D("type %s", mf.getValueByXpath("/p:manifest/p:ui-application/@type").c_str()); + LogDebug("type " << mf.getValueByXpath("/p:manifest/p:ui-application/@type")); RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/@type") == "webapp"); - _D("extraid %s", mf.getValueByXpath("/p:manifest/p:ui-application/@extraid").c_str()); + LogDebug("extraid " << mf.getValueByXpath("/p:manifest/p:ui-application/@extraid")); RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/@extraid") == "http://test.samsung.com/widget/manifestTest"); - _D("taskmanage %s", mf.getValueByXpath("/p:manifest/p:ui-application/@taskmanage").c_str()); + LogDebug("taskmanage " << mf.getValueByXpath("/p:manifest/p:ui-application/@taskmanage")); RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/@taskmanage") == "true"); - _D("icon %s", mf.getValueByXpath("/p:manifest/p:ui-application/p:icon").c_str()); + LogDebug("icon " << mf.getValueByXpath("/p:manifest/p:ui-application/p:icon")); RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/p:icon") == (tizenId + ".png")); diff --git a/tests/general/ParsingTizenAppcontrolTests.cpp b/tests/general/ParsingTizenAppcontrolTests.cpp index 507c5b0..67572f1 100644 --- a/tests/general/ParsingTizenAppcontrolTests.cpp +++ b/tests/general/ParsingTizenAppcontrolTests.cpp @@ -23,10 +23,10 @@ #include #include +#include #include #include #include -#include using namespace InstallerWrapper; @@ -50,7 +50,7 @@ RUNNER_TEST(tizen_app_control) dao.getAppControlList(appcontrolList); uninstall(tizenId); - _D("Actual size %ls", appcontrolList.size().c_str()); + LogDebug("Actual size" << appcontrolList.size()); RUNNER_ASSERT_MSG(appcontrolList.size() == 4, "Incorrect list size"); WrtDB::WidgetAppControl s; s.src = DPL::FromUTF8String("edit1.html"); diff --git a/tests/general/PluginsInstallation.cpp b/tests/general/PluginsInstallation.cpp index 8a779ea..3a03ad8 100644 --- a/tests/general/PluginsInstallation.cpp +++ b/tests/general/PluginsInstallation.cpp @@ -22,9 +22,9 @@ #include #include +#include #include #include -#include //////////////////////////////////////////////////////////////////////////////// @@ -43,7 +43,7 @@ STATIC_BLOCK WrtDB::PluginDAOReadOnly pdao(#LIBNAME); \ RUNNER_ASSERT_MSG(pdao.getInstallationStatus() == WrtDB::PluginDAOReadOnly::INSTALLATION_COMPLETED, "Plugin is not installed correctly"); \ } Catch(DPL::Exception) { \ - _E("%s", _rethrown_exception.DumpToString().c_str()); \ + LogError(_rethrown_exception.DumpToString()); \ RUNNER_ASSERT_MSG(false, "DPL::Exception"); \ } \ } \ diff --git a/tests/general/TestInit.cpp b/tests/general/TestInit.cpp index c0b3bc9..4e4e635 100644 --- a/tests/general/TestInit.cpp +++ b/tests/general/TestInit.cpp @@ -21,12 +21,12 @@ */ #include -#include +#include #include int main (int argc, char *argv[]) { - _D("Starting tests"); + LogDebug("Starting tests"); WrtDB::WrtDatabase::attachToThreadRW(); int status =