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