diff --git a/services/distributeddataservice/adapter/account/src/account_delegate_impl.cpp b/services/distributeddataservice/adapter/account/src/account_delegate_impl.cpp index b8c4214c332010c17976202ced83fa081bb47c23..6ef67320ed6d23c427b74e2c0cdcaa14b1279e87 100644 --- a/services/distributeddataservice/adapter/account/src/account_delegate_impl.cpp +++ b/services/distributeddataservice/adapter/account/src/account_delegate_impl.cpp @@ -41,7 +41,7 @@ void EventSubscriber::OnReceiveEvent(const CommonEventData &event) const auto want = event.GetWant(); AccountEventInfo accountEventInfo {}; std::string action = want.GetAction(); - ZLOGI("Want Action is %s", action.c_str()); + ZLOGI("Want Action = %s", action.c_str()); if (action == CommonEventSupport::COMMON_EVENT_USER_REMOVED) { accountEventInfo.status = AccountStatus::DEVICE_ACCOUNT_DELETE; @@ -84,7 +84,7 @@ AccountDelegateImpl::~AccountDelegateImpl() observerMap_.Clear(); const auto result = CommonEventManager::UnSubscribeCommonEvent(eventSubscriber_); if (!result) { - ZLOGE("Fail to unregister account event listener!"); + ZLOGE("Failed to unregister account event listener!"); } } @@ -113,14 +113,14 @@ void AccountDelegateImpl::SubscribeAccountEvent() break; } - ZLOGE("EventManager: Fail to register subscriber, error:%d", result); + ZLOGE("EventManager: Failed to register subscriber, error=%d", result); sleep(RETRY_WAIT_TIME_S); tryTimes++; } if (tryTimes == MAX_RETRY_TIME) { - ZLOGE("EventManager: Fail to register subscriber!"); + ZLOGE("EventManager: Failed to register subscriber!"); } - ZLOGI("EventManager: Success to register subscriber."); + ZLOGI("EventManager: Successful to register subscriber."); }); th.detach(); } @@ -149,7 +149,7 @@ std::string AccountDelegateImpl::GetDeviceAccountIdByUID(int32_t uid) const int userId = 0; auto ret = AccountSA::OsAccountManager::GetOsAccountLocalIdFromUid(uid, userId); if (ret != 0) { - ZLOGE("failed get os account local id from uid, ret:%{public}d", ret); + ZLOGE("failed get os account local id from uid, ret=%{public}d", ret); return {}; } return std::to_string(userId); @@ -178,7 +178,7 @@ Status AccountDelegateImpl::Subscribe(std::shared_ptr observer) ZLOGD("end"); return Status::SUCCESS; } - ZLOGE("fail"); + ZLOGE("failed"); return Status::ERROR; } @@ -197,7 +197,7 @@ Status AccountDelegateImpl::Unsubscribe(std::shared_ptr observer) ZLOGD("end"); return Status::SUCCESS; } - ZLOGD("fail"); + ZLOGD("failed"); return Status::ERROR; } diff --git a/services/distributeddataservice/adapter/account/test/account_delegate_test.cpp b/services/distributeddataservice/adapter/account/test/account_delegate_test.cpp index 0655433455b601952bb85448890db7cb5cd0440d..e31f576999acaea52be41bbd5b2f641059861899 100644 --- a/services/distributeddataservice/adapter/account/test/account_delegate_test.cpp +++ b/services/distributeddataservice/adapter/account/test/account_delegate_test.cpp @@ -65,6 +65,6 @@ HWTEST_F(AccountDelegateTest, Test001, TestSize.Level0) HWTEST_F(AccountDelegateTest, Test002, TestSize.Level0) { auto id = AccountDelegate::GetInstance()->GetDeviceAccountIdByUID(getuid()); - ZLOGD("observer subscribed %s", id.c_str()); + ZLOGD("observer subscribed = %s", id.c_str()); ASSERT_TRUE(!id.empty()); } diff --git a/services/distributeddataservice/adapter/auth/src/auth_delegate.cpp b/services/distributeddataservice/adapter/auth/src/auth_delegate.cpp index 062c5b4c4ca41af8158593ca9915cec1d2dd5a63..69ffc9a66180ca84b83eedcfd16e8f90ee2baf83 100644 --- a/services/distributeddataservice/adapter/auth/src/auth_delegate.cpp +++ b/services/distributeddataservice/adapter/auth/src/auth_delegate.cpp @@ -28,7 +28,7 @@ bool AuthHandler::CheckAccess( { auto group = GetGroupInfo(localUserId, appId, peerDeviceId); if (group.groupType < GroupType::ALL_GROUP) { - ZLOGE("failed to parse group %{public}s)", group.groupId.c_str()); + ZLOGE("failed to parse groupId = %{public}s)", group.groupId.c_str()); return false; } auto groupManager = GetGmInstance(); @@ -37,7 +37,7 @@ bool AuthHandler::CheckAccess( return false; } auto ret = groupManager->checkAccessToGroup(localUserId, appId.c_str(), group.groupId.c_str()); - ZLOGD("check access to group ret:%{public}d", ret); + ZLOGD("check access to group ret=%{public}d", ret); return ret == HC_SUCCESS; } @@ -46,7 +46,7 @@ int32_t AuthHandler::GetGroupType( { auto group = GetGroupInfo(localUserId, appId, peerDeviceId); if (group.groupType < GroupType::ALL_GROUP) { - ZLOGE("failed to parse group json(%{public}d)", group.groupType); + ZLOGE("failed to parse group json(groupType=%{public}d)", group.groupType); } return group.groupType; } @@ -61,13 +61,13 @@ AuthHandler::RelatedGroup AuthHandler::GetGroupInfo( } char *groupInfo = nullptr; uint32_t groupNum = 0; - ZLOGI("get related groups, user:%{public}d, app:%{public}s", localUserId, appId.c_str()); + ZLOGI("get related groups, user = %{public}d, app= %{public}s", localUserId, appId.c_str()); auto ret = groupManager->getRelatedGroups(localUserId, appId.c_str(), peerDeviceId.c_str(), &groupInfo, &groupNum); if (groupInfo == nullptr) { - ZLOGE("failed to get related groups, ret:%{public}d", ret); + ZLOGE("failed to get related groups, ret = %{public}d", ret); return {}; } - ZLOGI("get related group json :%{public}s", groupInfo); + ZLOGI("get related group json groupInfo = %{public}s", groupInfo); std::vector groups; RelatedGroup::Unmarshall(groupInfo, groups); groupManager->destroyInfo(&groupInfo); @@ -76,10 +76,10 @@ AuthHandler::RelatedGroup AuthHandler::GetGroupInfo( std::sort(groups.begin(), groups.end(), [](const RelatedGroup &group1, const RelatedGroup &group2) { return group1.groupType < group2.groupType; }); if (!groups.empty()) { - ZLOGI("get group type:%{public}d", groups.front().groupType); + ZLOGI("get group type = %{public}d", groups.front().groupType); return groups.front(); } - ZLOGD("there is no group to access to peer device:%{public}.10s", peerDeviceId.c_str()); + ZLOGD("there is no group to access to peer device = %{public}.10s", peerDeviceId.c_str()); return {}; } @@ -95,13 +95,13 @@ std::vector AuthHandler::GetTrustedDevicesByType( char *groupsJson = nullptr; uint32_t groupNum = 0; - ZLOGI("get joined groups, user:%{public}d, app:%{public}s, type:%{public}d", localUserId, appId.c_str(), type); + ZLOGI("get joined groups, user=%{public}d, app=%{public}s, type=%{public}d", localUserId, appId.c_str(), type); auto ret = groupManager->getJoinedGroups(localUserId, appId.c_str(), type, &groupsJson, &groupNum); if (groupsJson == nullptr) { - ZLOGE("failed to get joined groups, ret:%{public}d", ret); + ZLOGE("failed to get joined groups, ret=%{public}d", ret); return {}; } - ZLOGI("get joined group json :%{public}s", groupsJson); + ZLOGI("get joined group json = %{public}s", groupsJson); std::vector groups; RelatedGroup::Unmarshall(groupsJson, groups); groupManager->destroyInfo(&groupsJson); @@ -115,10 +115,10 @@ std::vector AuthHandler::GetTrustedDevicesByType( uint32_t devNum = 0; ret = groupManager->getTrustedDevices(localUserId, appId.c_str(), group.groupId.c_str(), &devicesJson, &devNum); if (devicesJson == nullptr) { - ZLOGE("failed to get trusted devicesJson, ret:%{public}d", ret); + ZLOGE("failed to get trusted devicesJson, ret=%{public}d", ret); return {}; } - ZLOGI("get trusted device json:%{public}s", devicesJson); + ZLOGI("get trusted device json=%{public}s", devicesJson); std::vector devices; TrustDevice::Unmarshall(devicesJson, devices); groupManager->destroyInfo(&devicesJson); @@ -143,7 +143,7 @@ bool AuthHandlerStub::CheckAccess( } bool isSystemApp = checker->IsValid(UID_CAPACITY * localUserId, appId); if (isSystemApp) { - ZLOGE("system app:%{public}s", appId.c_str()); + ZLOGE("system app=%{public}s", appId.c_str()); return peerUserId == SYSTEM_USER; } return peerUserId != SYSTEM_USER; diff --git a/services/distributeddataservice/adapter/autils/src/directory_utils.cpp b/services/distributeddataservice/adapter/autils/src/directory_utils.cpp index 333a4b175bdf212912d9e500a3bfd8a8cf403ce4..873ed81138c07c21e399b18f24870bc27c7c93d3 100644 --- a/services/distributeddataservice/adapter/autils/src/directory_utils.cpp +++ b/services/distributeddataservice/adapter/autils/src/directory_utils.cpp @@ -53,10 +53,10 @@ bool DirectoryUtils::ChangeModeFileOnly(const std::string &path, const mode_t &m // change the mode of file only. if ((access(subPath.c_str(), F_OK) == 0) && (ptr->d_type == DT_REG)) { - ZLOGD("[Von-Debug]change the file[%s] to mode[%d].", subPath.c_str(), mode); + ZLOGD("[Von-Debug]change the file = %s to mode = %d.", subPath.c_str(), mode); if (!ChangeMode(subPath, mode)) { closedir(dir); - ZLOGD("[Von-Debug]change the file[%s] to mode[%d] failed.", subPath.c_str(), mode); + ZLOGD("[Von-Debug]change the file = %s to mode = %d failed.", subPath.c_str(), mode); return false; } } @@ -95,10 +95,10 @@ bool DirectoryUtils::ChangeModeDirOnly(const std::string &path, const mode_t &mo // change the mode of directory only. if ((access(subPath.c_str(), F_OK) == 0) && (ptr->d_type == DT_DIR)) { - ZLOGD("[Von-Debug]change the dir[%s] to mode[%d].", subPath.c_str(), mode); + ZLOGD("[Von-Debug]change the dir = %s to mode = %d.", subPath.c_str(), mode); if (!ChangeMode(subPath, mode)) { closedir(dir); - ZLOGD("[Von-Debug]change the dir[%s] to mode[%d] failed.", subPath.c_str(), mode); + ZLOGD("[Von-Debug]change the dir = %s to mode = %d failed.", subPath.c_str(), mode); return false; } } diff --git a/services/distributeddataservice/adapter/broadcaster/src/broadcast_sender_impl.cpp b/services/distributeddataservice/adapter/broadcaster/src/broadcast_sender_impl.cpp index b3fe7cdb27946dccac5118e3dc7085e889d3496d..f2a308b487fc53bfe1506c2833b7140786ad2ab8 100644 --- a/services/distributeddataservice/adapter/broadcaster/src/broadcast_sender_impl.cpp +++ b/services/distributeddataservice/adapter/broadcaster/src/broadcast_sender_impl.cpp @@ -58,6 +58,6 @@ void BroadcastSenderImpl::SendEvent(const EventParams ¶ms) result = CommonEventManager::PublishCommonEvent(commonEventData); } CommonEventManager::UnSubscribeCommonEvent(subscriberPtr); - ZLOGI("SendEvent result:%{public}d.", result); + ZLOGI("SendEvent result = %{public}d.", result); } } diff --git a/services/distributeddataservice/adapter/communicator/src/app_pipe_handler.cpp b/services/distributeddataservice/adapter/communicator/src/app_pipe_handler.cpp index 7703672b511167fde7ee5d3590ea2a4581d80b34..d8b32c7f0246d5ad50b86f5aee52468f820a5c81 100644 --- a/services/distributeddataservice/adapter/communicator/src/app_pipe_handler.cpp +++ b/services/distributeddataservice/adapter/communicator/src/app_pipe_handler.cpp @@ -34,13 +34,13 @@ using namespace OHOS::DistributedKv; AppPipeHandler::~AppPipeHandler() { - ZLOGI("destructor pipeId: %{public}s", pipeInfo_.pipeId.c_str()); + ZLOGI("destructor pipeId = %{public}s", pipeInfo_.pipeId.c_str()); } AppPipeHandler::AppPipeHandler(const PipeInfo &pipeInfo) : pipeInfo_(pipeInfo) { - ZLOGI("constructor pipeId: %{public}s", pipeInfo_.pipeId.c_str()); + ZLOGI("constructor pipeId = %{public}s", pipeInfo_.pipeId.c_str()); softbusAdapter_ = SoftBusAdapter::GetInstance(); } diff --git a/services/distributeddataservice/adapter/communicator/src/app_pipe_mgr.cpp b/services/distributeddataservice/adapter/communicator/src/app_pipe_mgr.cpp index d6580c8b81798e51d310e7aa699af842eada3a6e..4cae8792d0c031144eea53ea1dfd0e386655359a 100644 --- a/services/distributeddataservice/adapter/communicator/src/app_pipe_mgr.cpp +++ b/services/distributeddataservice/adapter/communicator/src/app_pipe_mgr.cpp @@ -63,16 +63,16 @@ Status AppPipeMgr::SendData(const PipeInfo &pipeInfo, const DeviceId &deviceId, { if (size > DataBuffer::MAX_TRANSFER_SIZE || size <= 0 || ptr == nullptr || pipeInfo.pipeId.empty() || deviceId.deviceId.empty()) { - ZLOGW("Input is invalid, maxSize:%d, current size:%d", DataBuffer::MAX_TRANSFER_SIZE, size); + ZLOGW("Input is invalid, maxSize = %d, current size = %d", DataBuffer::MAX_TRANSFER_SIZE, size); return Status::ERROR; } - ZLOGD("pipeInfo:%s ,size:%d", pipeInfo.pipeId.c_str(), size); + ZLOGD("pipeInfo = %s ,size = %d", pipeInfo.pipeId.c_str(), size); std::shared_ptr appPipeHandler; { std::lock_guard lock(dataBusMapMutex_); auto it = dataBusMap_.find(pipeInfo.pipeId); if (it == dataBusMap_.end()) { - ZLOGW("pipeInfo:%s not found", pipeInfo.pipeId.c_str()); + ZLOGW("pipeInfo = %s not found", pipeInfo.pipeId.c_str()); return Status::KEY_NOT_FOUND; } appPipeHandler = it->second; @@ -90,14 +90,14 @@ Status AppPipeMgr::Start(const PipeInfo &pipeInfo) std::lock_guard lock(dataBusMapMutex_); auto it = dataBusMap_.find(pipeInfo.pipeId); if (it != dataBusMap_.end()) { - ZLOGW("repeated start, pipeInfo:%{public}s.", pipeInfo.pipeId.c_str()); + ZLOGW("repeated start, pipeInfo=%{public}s.", pipeInfo.pipeId.c_str()); return Status::SUCCESS; } - ZLOGD("Start pipeInfo:%{public}s ", pipeInfo.pipeId.c_str()); + ZLOGD("Start pipeInfo = %{public}s ", pipeInfo.pipeId.c_str()); auto handler = std::make_shared(pipeInfo); int ret = handler->CreateSessionServer(pipeInfo.pipeId); if (ret != 0) { - ZLOGW("Start pipeInfo:%{public}s, failed ret:%{public}d.", pipeInfo.pipeId.c_str(), ret); + ZLOGW("Start pipeInfo = %{public}s, failed ret = %{public}d.", pipeInfo.pipeId.c_str(), ret); return Status::ILLEGAL_STATE; } @@ -111,13 +111,13 @@ Status AppPipeMgr::Stop(const PipeInfo &pipeInfo) std::lock_guard lock(dataBusMapMutex_); auto it = dataBusMap_.find(pipeInfo.pipeId); if (it == dataBusMap_.end()) { - ZLOGW("pipeInfo:%s not found", pipeInfo.pipeId.c_str()); + ZLOGW("pipeInfo=%s not found", pipeInfo.pipeId.c_str()); return Status::KEY_NOT_FOUND; } std::shared_ptr appPipeHandler = it->second; int ret = appPipeHandler->RemoveSessionServer(pipeInfo.pipeId); if (ret != 0) { - ZLOGW("Stop pipeInfo:%s ret:%d.", pipeInfo.pipeId.c_str(), ret); + ZLOGW("Stop pipeInfo=%s ret=%d.", pipeInfo.pipeId.c_str(), ret); return Status::ERROR; } dataBusMap_.erase(pipeInfo.pipeId); @@ -131,13 +131,13 @@ bool AppPipeMgr::IsSameStartedOnPeer(const struct PipeInfo &pipeInfo, const stru ZLOGE("pipeId or deviceId is empty. Return false."); return false; } - ZLOGI("pipeInfo == [%s]", pipeInfo.pipeId.c_str()); + ZLOGI("pipeInfo = %s", pipeInfo.pipeId.c_str()); std::shared_ptr appPipeHandler; { std::lock_guard lock(dataBusMapMutex_); auto it = dataBusMap_.find(pipeInfo.pipeId); if (it == dataBusMap_.end()) { - ZLOGE("pipeInfo:%s not found. Return false.", pipeInfo.pipeId.c_str()); + ZLOGE("pipeInfo = %s not found. Return false.", pipeInfo.pipeId.c_str()); return false; } appPipeHandler = it->second; @@ -155,7 +155,7 @@ void AppPipeMgr::SetMessageTransFlag(const PipeInfo &pipeInfo, bool flag) std::lock_guard lock(dataBusMapMutex_); auto it = dataBusMap_.find(pipeInfo.pipeId); if (it == dataBusMap_.end()) { - ZLOGW("pipeInfo:%s not found", pipeInfo.pipeId.c_str()); + ZLOGW("pipeInfo = %s not found", pipeInfo.pipeId.c_str()); return; } appPipeHandler = it->second; diff --git a/services/distributeddataservice/adapter/communicator/src/process_communicator_impl.cpp b/services/distributeddataservice/adapter/communicator/src/process_communicator_impl.cpp index 8631d985f4a18f9d4a5d24f9ac176d42f5d5c6fe..1b0123e688596162f5e8e7cae22d029c4b2b6776 100644 --- a/services/distributeddataservice/adapter/communicator/src/process_communicator_impl.cpp +++ b/services/distributeddataservice/adapter/communicator/src/process_communicator_impl.cpp @@ -43,7 +43,7 @@ DBStatus ProcessCommunicatorImpl::Start(const std::string &processLabel) PipeInfo pi = {thisProcessLabel_, ""}; Status errCode = CommunicationProvider::GetInstance().Start(pi); if (errCode != Status::SUCCESS) { - ZLOGE("commProvider_ Start Fail."); + ZLOGE("commProvider_ Start Failed."); return DBStatus::DB_ERROR; } return DBStatus::OK; @@ -54,7 +54,7 @@ DBStatus ProcessCommunicatorImpl::Stop() PipeInfo pi = {thisProcessLabel_, ""}; Status errCode = CommunicationProvider::GetInstance().Stop(pi); if (errCode != Status::SUCCESS) { - ZLOGE("commProvider_ Stop Fail."); + ZLOGE("commProvider_ Stop Failed."); return DBStatus::DB_ERROR; } return DBStatus::OK; @@ -71,13 +71,13 @@ DBStatus ProcessCommunicatorImpl::RegOnDeviceChange(const OnDeviceChange &callba if (callback) { Status errCode = CommunicationProvider::GetInstance().StartWatchDeviceChange(this, pi); if (errCode != Status::SUCCESS) { - ZLOGE("commProvider_ StartWatchDeviceChange Fail."); + ZLOGE("commProvider_ StartWatchDeviceChange Failed."); return DBStatus::DB_ERROR; } } else { Status errCode = CommunicationProvider::GetInstance().StopWatchDeviceChange(this, pi); if (errCode != Status::SUCCESS) { - ZLOGE("commProvider_ StopWatchDeviceChange Fail."); + ZLOGE("commProvider_ StopWatchDeviceChange Failed."); return DBStatus::DB_ERROR; } } @@ -96,13 +96,13 @@ DBStatus ProcessCommunicatorImpl::RegOnDataReceive(const OnDataReceive &callback if (callback) { Status errCode = CommunicationProvider::GetInstance().StartWatchDataChange(this, pi); if (errCode != Status::SUCCESS) { - ZLOGE("commProvider_ StartWatchDataChange Fail."); + ZLOGE("commProvider_ StartWatchDataChange Failed."); return DBStatus::DB_ERROR; } } else { Status errCode = CommunicationProvider::GetInstance().StopWatchDataChange(this, pi); if (errCode != Status::SUCCESS) { - ZLOGE("commProvider_ StopWatchDataChange Fail."); + ZLOGE("commProvider_ StopWatchDataChange Failed."); return DBStatus::DB_ERROR; } } @@ -116,7 +116,7 @@ DBStatus ProcessCommunicatorImpl::SendData(const DeviceInfos &dstDevInfo, const destination.deviceId = dstDevInfo.identifier; Status errCode = CommunicationProvider::GetInstance().SendData(pi, destination, data, static_cast(length)); if (errCode != Status::SUCCESS) { - ZLOGE("commProvider_ SendData Fail."); + ZLOGE("commProvider_ SendData Failed."); return DBStatus::DB_ERROR; } @@ -133,7 +133,7 @@ uint32_t ProcessCommunicatorImpl::GetMtuSize(const DeviceInfos &devInfo) ZLOGI("GetMtuSize start"); std::vector devInfos = CommunicationProvider::GetInstance().GetDeviceList(); for (auto const &entry : devInfos) { - ZLOGI("GetMtuSize deviceType: %{public}s", entry.deviceType.c_str()); + ZLOGI("GetMtuSize deviceType = %{public}s", entry.deviceType.c_str()); bool isWatch = (entry.deviceType == SMART_WATCH_TYPE || entry.deviceType == CHILDREN_WATCH_TYPE); if (entry.deviceId == devInfo.identifier && isWatch) { return MTU_SIZE_WATCH; @@ -223,7 +223,7 @@ DBStatus ProcessCommunicatorImpl::CheckAndGetDataHeadInfo( ZLOGW("no valid user"); return DBStatus::NO_PERMISSION; } - ZLOGD("ok, result:%{public}u, user:%{public}s", users.size(), users.front().c_str()); + ZLOGD("ok, result = %{public}u, user = %{public}s", users.size(), users.front().c_str()); return DBStatus::OK; } } // namespace AppDistributedKv diff --git a/services/distributeddataservice/adapter/communicator/src/softbus_adapter_standard.cpp b/services/distributeddataservice/adapter/communicator/src/softbus_adapter_standard.cpp index 98cff7809367ad8f43e567e7c00bf33edd46579a..867a1bdea018d29e4870a12dbe4e52f6c05b5269 100644 --- a/services/distributeddataservice/adapter/communicator/src/softbus_adapter_standard.cpp +++ b/services/distributeddataservice/adapter/communicator/src/softbus_adapter_standard.cpp @@ -80,14 +80,14 @@ std::shared_ptr SoftBusAdapter::instance_; void AppDeviceListenerWrap::OnDeviceInfoChanged(NodeBasicInfoType type, NodeBasicInfo *info) { std::string uuid = softBusAdapter_->GetUuidByNodeId(std::string(info->networkId)); - ZLOGI("[InfoChange] type:%{public}d, id:%{public}s, name:%{public}s", + ZLOGI("[InfoChange] type = %{public}d, id = %{public}s, name = %{public}s", type, SoftBusAdapter::ToBeAnonymous(uuid).c_str(), info->deviceName); } void AppDeviceListenerWrap::OnDeviceOffline(NodeBasicInfo *info) { std::string uuid = softBusAdapter_->GetUuidByNodeId(std::string(info->networkId)); - ZLOGI("[Offline] id:%{public}s, name:%{public}s, typeId:%{public}d", + ZLOGI("[Offline] id = %{public}s, name = %{public}s, typeId = %{public}d", SoftBusAdapter::ToBeAnonymous(uuid).c_str(), info->deviceName, info->deviceTypeId); NotifyAll(info, DeviceChangeType::DEVICE_OFFLINE); } @@ -95,7 +95,7 @@ void AppDeviceListenerWrap::OnDeviceOffline(NodeBasicInfo *info) void AppDeviceListenerWrap::OnDeviceOnline(NodeBasicInfo *info) { std::string uuid = softBusAdapter_->GetUuidByNodeId(std::string(info->networkId)); - ZLOGI("[Online] id:%{public}s, name:%{public}s, typeId:%{public}d", + ZLOGI("[Online] id = %{public}s, name = %{public}s, typeId = %{public}d", SoftBusAdapter::ToBeAnonymous(uuid).c_str(), info->deviceName, info->deviceTypeId); NotifyAll(info, DeviceChangeType::DEVICE_ONLINE); } @@ -134,7 +134,7 @@ SoftBusAdapter::~SoftBusAdapter() ZLOGI("begin"); int32_t errNo = UnregNodeDeviceStateCb(&nodeStateCb_); if (errNo != SOFTBUS_OK) { - ZLOGE("UnregNodeDeviceStateCb fail %{public}d", errNo); + ZLOGE("UnregNodeDeviceStateCb failed err = %{public}d", errNo); } } @@ -144,20 +144,20 @@ void SoftBusAdapter::Init() std::thread th = std::thread([this]() { auto communicator = std::make_shared(); auto retcom = DistributedDB::KvStoreDelegateManager::SetProcessCommunicator(communicator); - ZLOGI("set communicator ret:%{public}d.", static_cast(retcom)); + ZLOGI("set communicator ret = %{public}d.", static_cast(retcom)); int i = 0; constexpr int RETRY_TIMES = 300; while (i++ < RETRY_TIMES) { int32_t errNo = RegNodeDeviceStateCb("ohos.distributeddata", &nodeStateCb_); if (errNo != SOFTBUS_OK) { - ZLOGE("RegNodeDeviceStateCb fail %{public}d, time:%{public}d", errNo, i); + ZLOGE("RegNodeDeviceStateCb failed err = %{public}d, time = %{public}d", errNo, i); std::this_thread::sleep_for(std::chrono::seconds(1)); continue; } - ZLOGI("RegNodeDeviceStateCb success"); + ZLOGI("RegNodeDeviceStateCb successful"); return; } - ZLOGE("Init failed %{public}d times and exit now.", RETRY_TIMES); + ZLOGE("Init failed times = %{public}d and exit now.", RETRY_TIMES); }); th.detach(); } @@ -209,7 +209,7 @@ void SoftBusAdapter::NotifyAll(const DeviceInfo &deviceInfo, const DeviceChangeT } ZLOGD("high"); std::string uuid = GetUuidByNodeId(deviceInfo.deviceId); - ZLOGD("[Notify] to DB from: %{public}s, type:%{public}d", ToBeAnonymous(uuid).c_str(), type); + ZLOGD("[Notify] to DB from uuid = %{public}s, type = %{public}d", ToBeAnonymous(uuid).c_str(), type); UpdateRelationship(deviceInfo.deviceId, type); for (const auto &device : listeners) { if (device == nullptr) { @@ -258,7 +258,7 @@ std::vector SoftBusAdapter::GetDeviceList() const ZLOGE("GetAllNodeDeviceInfo error"); return dis; } - ZLOGD("GetAllNodeDeviceInfo success infoNum=%{public}d", infoNum); + ZLOGD("GetAllNodeDeviceInfo successful infoNum=%{public}d", infoNum); for (int i = 0; i < infoNum; i++) { std::string uuid = GetUuidByNodeId(std::string(info[i].networkId)); @@ -284,7 +284,7 @@ DeviceInfo SoftBusAdapter::GetLocalDevice() return DeviceInfo(); } std::string uuid = GetUuidByNodeId(std::string(info.networkId)); - ZLOGD("[LocalDevice] id:%{private}s, name:%{private}s, type:%{private}d", + ZLOGD("[LocalDevice] id = %{private}s, name = %{private}s, type = %{private}d", ToBeAnonymous(uuid).c_str(), info.deviceName, info.deviceTypeId); localInfo_ = {uuid, std::string(info.deviceName), std::to_string(info.deviceTypeId)}; return localInfo_; @@ -296,7 +296,7 @@ std::string SoftBusAdapter::GetUuidByNodeId(const std::string &nodeId) const int32_t ret = GetNodeKeyInfo("ohos.distributeddata", nodeId.c_str(), NodeDeviceInfoKey::NODE_KEY_UUID, reinterpret_cast(uuid), ID_BUF_LEN); if (ret != SOFTBUS_OK) { - ZLOGW("GetNodeKeyInfo error, nodeId:%{public}s", ToBeAnonymous(nodeId).c_str()); + ZLOGW("GetNodeKeyInfo error, nodeId = %{public}s", ToBeAnonymous(nodeId).c_str()); return ""; } return std::string(uuid); @@ -308,7 +308,7 @@ std::string SoftBusAdapter::GetUdidByNodeId(const std::string &nodeId) const int32_t ret = GetNodeKeyInfo("ohos.distributeddata", nodeId.c_str(), NodeDeviceInfoKey::NODE_KEY_UDID, reinterpret_cast(udid), ID_BUF_LEN); if (ret != SOFTBUS_OK) { - ZLOGW("GetNodeKeyInfo error, nodeId:%{public}s", ToBeAnonymous(nodeId).c_str()); + ZLOGW("GetNodeKeyInfo error, nodeId = %{public}s", ToBeAnonymous(nodeId).c_str()); return ""; } return std::string(udid); @@ -323,7 +323,7 @@ DeviceInfo SoftBusAdapter::GetLocalBasicInfo() const ZLOGE("GetLocalNodeDeviceInfo error"); return DeviceInfo(); } - ZLOGD("[LocalBasicInfo] networkId:%{private}s, name:%{private}s, type:%{private}d", + ZLOGD("[LocalBasicInfo] networkId = %{private}s, name = %{private}s, type = %{private}d", ToBeAnonymous(std::string(info.networkId)).c_str(), info.deviceName, info.deviceTypeId); DeviceInfo localInfo = {std::string(info.networkId), std::string(info.deviceName), std::to_string(info.deviceTypeId)}; @@ -343,7 +343,7 @@ std::vector SoftBusAdapter::GetRemoteNodesBasicInfo() const ZLOGE("GetAllNodeDeviceInfo error"); return dis; } - ZLOGD("GetAllNodeDeviceInfo success infoNum=%{public}d", infoNum); + ZLOGD("GetAllNodeDeviceInfo successful infoNum=%{public}d", infoNum); for (int i = 0; i < infoNum; i++) { dis.push_back({std::string(info[i].networkId), std::string(info[i].deviceName), @@ -364,7 +364,7 @@ void SoftBusAdapter::UpdateRelationship(const std::string &networkid, const Devi case DeviceChangeType::DEVICE_OFFLINE: { auto size = this->networkId2UuidUdid_.erase(networkid); if (size == 0) { - ZLOGW("not found id:%{public}s.", SoftBusAdapter::ToBeAnonymous(networkid).c_str()); + ZLOGW("not found id = %{public}s.", SoftBusAdapter::ToBeAnonymous(networkid).c_str()); } break; } @@ -478,7 +478,7 @@ Status SoftBusAdapter::StartWatchDataChange(const AppDataChangeListener *observe ZLOGW("Add listener error or repeated adding."); return Status::ERROR; } - ZLOGD("current appid %{public}s", pipeInfo.pipeId.c_str()); + ZLOGD("current appid = %{public}s", pipeInfo.pipeId.c_str()); dataChangeListeners_.insert({pipeInfo.pipeId, observer}); return Status::SUCCESS; } @@ -491,7 +491,7 @@ Status SoftBusAdapter::StopWatchDataChange(__attribute__((unused))const AppDataC if (dataChangeListeners_.erase(pipeInfo.pipeId)) { return Status::SUCCESS; } - ZLOGW("stop data observer error, pipeInfo:%{public}s", pipeInfo.pipeId.c_str()); + ZLOGW("stop data observer error, pipeInfo = %{public}s", pipeInfo.pipeId.c_str()); return Status::ERROR; } @@ -500,25 +500,25 @@ Status SoftBusAdapter::SendData(const PipeInfo &pipeInfo, const DeviceId &device { SessionAttribute attr; attr.dataType = TYPE_BYTES; - ZLOGD("[SendData] to %{public}s ,session:%{public}s, size:%{public}d", ToBeAnonymous(deviceId.deviceId).c_str(), + ZLOGD("[SendData] id=%{public}s ,session=%{public}s, size=%{public}d", ToBeAnonymous(deviceId.deviceId).c_str(), pipeInfo.pipeId.c_str(), size); int sessionId = OpenSession(pipeInfo.pipeId.c_str(), pipeInfo.pipeId.c_str(), ToNodeID("", deviceId.deviceId).c_str(), "GROUP_ID", &attr); if (sessionId < 0) { - ZLOGW("OpenSession %{public}s, type:%{public}d failed, sessionId:%{public}d", + ZLOGW("OpenSession pipeId=%{public}s, type=%{public}d failed, sessionId=%{public}d", pipeInfo.pipeId.c_str(), info.msgType, sessionId); return Status::NETWORK_ERROR; } int state = GetSessionStatus(sessionId); - ZLOGD("waited for notification, state:%{public}d", state); + ZLOGD("waited for notification, state=%{public}d", state); if (state != SOFTBUS_OK) { ZLOGE("OpenSession callback result error"); return Status::NETWORK_ERROR; } - ZLOGD("[SendBytes] start, size is %{public}d, session type is %{public}d.", size, attr.dataType); + ZLOGD("[SendBytes] start, size = %{public}d, session type = %{public}d.", size, attr.dataType); int32_t ret = SendBytes(sessionId, (void*)ptr, size); if (ret != SOFTBUS_OK) { - ZLOGE("[SendBytes] to %{public}d failed, ret:%{public}d.", sessionId, ret); + ZLOGE("[SendBytes] sessionId = %{public}d failed, ret = %{public}d.", sessionId, ret); return Status::ERROR; } return Status::SUCCESS; @@ -558,7 +558,7 @@ std::shared_ptr> SoftBusAdapter::GetSemaphore(int32_t session bool SoftBusAdapter::IsSameStartedOnPeer(const struct PipeInfo &pipeInfo, __attribute__((unused))const struct DeviceId &peer) { - ZLOGI("pipeInfo:%{public}s peer.deviceId:%{public}s", pipeInfo.pipeId.c_str(), + ZLOGI("pipeInfo id = %{public}s peer.deviceId = %{public}s", pipeInfo.pipeId.c_str(), ToBeAnonymous(peer.deviceId).c_str()); { lock_guard lock(busSessionMutex_); @@ -573,17 +573,17 @@ bool SoftBusAdapter::IsSameStartedOnPeer(const struct PipeInfo &pipeInfo, "GROUP_ID", &attr); ZLOGI("[IsSameStartedOnPeer] sessionId=%{public}d", sessionId); if (sessionId == INVALID_SESSION_ID) { - ZLOGE("OpenSession return null, pipeInfo:%{public}s. Return false.", pipeInfo.pipeId.c_str()); + ZLOGE("OpenSession return null, pipeInfo = %{public}s. Return false.", pipeInfo.pipeId.c_str()); return false; } - ZLOGI("session started, pipeInfo:%{public}s. sessionId:%{public}d Return true. ", + ZLOGI("session started, pipeInfo = %{public}s. sessionId = %{public}d Return true. ", pipeInfo.pipeId.c_str(), sessionId); return true; } void SoftBusAdapter::SetMessageTransFlag(const PipeInfo &pipeInfo, bool flag) { - ZLOGI("pipeInfo: %s flag: %d", pipeInfo.pipeId.c_str(), static_cast(flag)); + ZLOGI("pipeInfo:pipeId = %s, flag:=%d", pipeInfo.pipeId.c_str(), static_cast(flag)); flag_ = flag; } @@ -618,7 +618,7 @@ void SoftBusAdapter::NotifyDataListeners(const uint8_t *ptr, const int size, con lock_guard lock(dataChangeMutex_); auto it = dataChangeListeners_.find(pipeInfo.pipeId); if (it != dataChangeListeners_.end()) { - ZLOGD("ready to notify, pipeName:%{public}s, deviceId:%{public}s.", + ZLOGD("ready to notify, pipeName=%{public}s, deviceId=%{public}s.", pipeInfo.pipeId.c_str(), ToBeAnonymous(deviceId).c_str()); DeviceInfo deviceInfo = {deviceId, "", ""}; it->second->OnMessage(deviceInfo, ptr, size, pipeInfo); @@ -626,7 +626,7 @@ void SoftBusAdapter::NotifyDataListeners(const uint8_t *ptr, const int size, con Reporter::GetInstance()->TrafficStatistic()->Report(ts); return; } - ZLOGW("no listener %{public}s.", pipeInfo.pipeId.c_str()); + ZLOGW("no listener pipeId = %{public}s.", pipeInfo.pipeId.c_str()); } void AppDataListenerWrap::SetDataHandler(SoftBusAdapter *handler) @@ -637,33 +637,33 @@ void AppDataListenerWrap::SetDataHandler(SoftBusAdapter *handler) int AppDataListenerWrap::OnSessionOpened(int sessionId, int result) { - ZLOGI("[SessionOpen] sessionId:%{public}d, result:%{public}d", sessionId, result); + ZLOGI("[SessionOpen] sessionId=%{public}d, result=%{public}d", sessionId, result); char mySessionName[SESSION_NAME_SIZE_MAX] = ""; char peerSessionName[SESSION_NAME_SIZE_MAX] = ""; char peerDevId[DEVICE_ID_SIZE_MAX] = ""; softBusAdapter_->OnSessionOpen(sessionId, result); if (result != SOFTBUS_OK) { - ZLOGW("session %{public}d open failed, result:%{public}d.", sessionId, result); + ZLOGW("session sessionId=%{public}d open failed, result=%{public}d.", sessionId, result); return result; } int ret = GetMySessionName(sessionId, mySessionName, sizeof(mySessionName)); if (ret != SOFTBUS_OK) { - ZLOGW("get my session name failed, session id is %{public}d.", sessionId); + ZLOGW("get my session name failed, session id = %{public}d.", sessionId); return SOFTBUS_ERR; } ret = GetPeerSessionName(sessionId, peerSessionName, sizeof(peerSessionName)); if (ret != SOFTBUS_OK) { - ZLOGW("get my peer session name failed, session id is %{public}d.", sessionId); + ZLOGW("get my peer session name failed, session id = %{public}d.", sessionId); return SOFTBUS_ERR; } ret = GetPeerDeviceId(sessionId, peerDevId, sizeof(peerDevId)); if (ret != SOFTBUS_OK) { - ZLOGW("get my peer device id failed, session id is %{public}d.", sessionId); + ZLOGW("get my peer device id failed, session id = %{public}d.", sessionId); return SOFTBUS_ERR; } std::string peerUuid = softBusAdapter_->GetUuidByNodeId(std::string(peerDevId)); - ZLOGD("[SessionOpen] mySessionName:%{public}s, peerSessionName:%{public}s, peerDevId:%{public}s", + ZLOGD("[SessionOpen] mySessionName=%{public}s, peerSessionName=%{public}s, peerDevId=%{public}s", mySessionName, peerSessionName, SoftBusAdapter::ToBeAnonymous(peerUuid).c_str()); if (strlen(peerSessionName) < 1) { @@ -676,7 +676,7 @@ int AppDataListenerWrap::OnSessionOpened(int sessionId, int result) void AppDataListenerWrap::OnSessionClosed(int sessionId) { - ZLOGI("[SessionClosed] sessionId:%{public}d", sessionId); + ZLOGI("[SessionClosed] sessionId=%{public}d", sessionId); char mySessionName[SESSION_NAME_SIZE_MAX] = ""; char peerSessionName[SESSION_NAME_SIZE_MAX] = ""; char peerDevId[DEVICE_ID_SIZE_MAX] = ""; @@ -684,7 +684,7 @@ void AppDataListenerWrap::OnSessionClosed(int sessionId) softBusAdapter_->OnSessionClose(sessionId); int ret = GetMySessionName(sessionId, mySessionName, sizeof(mySessionName)); if (ret != SOFTBUS_OK) { - ZLOGW("get my session name failed, session id is %{public}d.", sessionId); + ZLOGW("get my session name failed, session id = %{public}d.", sessionId); return; } ret = GetPeerSessionName(sessionId, peerSessionName, sizeof(peerSessionName)); @@ -694,11 +694,11 @@ void AppDataListenerWrap::OnSessionClosed(int sessionId) } ret = GetPeerDeviceId(sessionId, peerDevId, sizeof(peerDevId)); if (ret != SOFTBUS_OK) { - ZLOGW("get my peer device id failed, session id is %{public}d.", sessionId); + ZLOGW("get my peer device id failed, session id = %{public}d.", sessionId); return; } std::string peerUuid = softBusAdapter_->GetUuidByNodeId(std::string(peerDevId)); - ZLOGD("[SessionClosed] mySessionName:%{public}s, peerSessionName:%{public}s, peerDevId:%{public}s", + ZLOGD("[SessionClosed] mySessionName=%{public}s, peerSessionName=%{public}s, peerDevId=%{public}s", mySessionName, peerSessionName, SoftBusAdapter::ToBeAnonymous(peerUuid).c_str()); if (strlen(peerSessionName) < 1) { @@ -718,16 +718,16 @@ void AppDataListenerWrap::OnMessageReceived(int sessionId, const void *data, uns char peerDevId[DEVICE_ID_SIZE_MAX] = ""; int ret = GetPeerSessionName(sessionId, peerSessionName, sizeof(peerSessionName)); if (ret != SOFTBUS_OK) { - ZLOGW("get my peer session name failed, session id is %{public}d.", sessionId); + ZLOGW("get my peer session name failed, session id = %{public}d.", sessionId); return; } ret = GetPeerDeviceId(sessionId, peerDevId, sizeof(peerDevId)); if (ret != SOFTBUS_OK) { - ZLOGW("get my peer device id failed, session id is %{public}d.", sessionId); + ZLOGW("get my peer device id failed, session id = %{public}d.", sessionId); return; } std::string peerUuid = softBusAdapter_->GetUuidByNodeId(std::string(peerDevId)); - ZLOGD("[MessageReceived] peerSessionName:%{public}s, peerDevId:%{public}s", peerSessionName, + ZLOGD("[MessageReceived] peerSessionName=%{public}s, peerDevId=%{public}s", peerSessionName, SoftBusAdapter::ToBeAnonymous(peerUuid).c_str()); NotifyDataListeners(reinterpret_cast(data), dataLen, peerUuid, {std::string(peerSessionName), ""}); } @@ -742,16 +742,16 @@ void AppDataListenerWrap::OnBytesReceived(int sessionId, const void *data, unsig char peerDevId[DEVICE_ID_SIZE_MAX] = ""; int ret = GetPeerSessionName(sessionId, peerSessionName, sizeof(peerSessionName)); if (ret != SOFTBUS_OK) { - ZLOGW("get my peer session name failed, session id is %{public}d.", sessionId); + ZLOGW("get my peer session name failed, session id = %{public}d.", sessionId); return; } ret = GetPeerDeviceId(sessionId, peerDevId, sizeof(peerDevId)); if (ret != SOFTBUS_OK) { - ZLOGW("get my peer device id failed, session id is %{public}d.", sessionId); + ZLOGW("get my peer device id failed, session id = %{public}d.", sessionId); return; } std::string peerUuid = softBusAdapter_->GetUuidByNodeId(std::string(peerDevId)); - ZLOGD("[BytesReceived] peerSessionName:%{public}s, peerDevId:%{public}s", peerSessionName, + ZLOGD("[BytesReceived] peerSessionName=%{public}s, peerDevId=%{public}s", peerSessionName, SoftBusAdapter::ToBeAnonymous(peerUuid).c_str()); NotifyDataListeners(reinterpret_cast(data), dataLen, peerUuid, {std::string(peerSessionName), ""}); } diff --git a/services/distributeddataservice/adapter/communicator/test/unittest/communication_provider_impl_test.cpp b/services/distributeddataservice/adapter/communicator/test/unittest/communication_provider_impl_test.cpp index a098c5d7cd0e24148c704da5e997bc507a1c722f..3e0f0f458578571818a8a7b856101e165360b860 100644 --- a/services/distributeddataservice/adapter/communicator/test/unittest/communication_provider_impl_test.cpp +++ b/services/distributeddataservice/adapter/communicator/test/unittest/communication_provider_impl_test.cpp @@ -36,7 +36,7 @@ class AppDataChangeListenerImpl : public AppDataChangeListener { void AppDataChangeListenerImpl::OnMessage(const OHOS::AppDistributedKv::DeviceInfo &info, const uint8_t *ptr, const int size, const struct PipeInfo &id) const { - ZLOGI("data %{public}s %s", info.deviceName.c_str(), ptr); + ZLOGI("data deviceName = %{public}s, ptr = %s", info.deviceName.c_str(), ptr); } class AppDeviceStatusChangeListenerImpl : public AppDeviceChangeListener { @@ -49,7 +49,7 @@ public: void AppDeviceStatusChangeListenerImpl::OnDeviceChanged(const OHOS::AppDistributedKv::DeviceInfo &info, const DeviceChangeType &type) const { - ZLOGI("%{public}s %{public}d", info.deviceName.c_str(), static_cast(type)); + ZLOGI("deviceName = %{public}s, data = %{public}d", info.deviceName.c_str(), static_cast(type)); } AppDeviceStatusChangeListenerImpl::~AppDeviceStatusChangeListenerImpl() @@ -91,7 +91,7 @@ HWTEST_F(CommunicationProviderImplTest, CommunicationProvider004, TestSize.Level appId.pipeId = "appId"; appId.userId = "groupId"; auto secRegister = CommunicationProvider::GetInstance().StopWatchDataChange(dataListener, appId); - ZLOGD("CommunicationProvider004 %d", static_cast(secRegister)); + ZLOGD("CommunicationProvider004 = %d", static_cast(secRegister)); EXPECT_EQ(Status::ERROR, secRegister); sleep(1); // avoid thread dnet thread died, then will have pthread; } @@ -130,10 +130,10 @@ HWTEST_F(CommunicationProviderImplTest, CommunicationProvider006, TestSize.Level ZLOGI("GetDeviceList"); auto devices = CommunicationProvider::GetInstance().GetDeviceList(); const unsigned long val = 0; - ZLOGD("GetDeviceList size: %zu", devices.size()); + ZLOGD("GetDeviceList size = %zu", devices.size()); ASSERT_GE(devices.size(), val); for (const auto &device : devices) { - ZLOGD("GetDeviceList, name:%s, type:%s", device.deviceName.c_str(), device.deviceType.c_str()); + ZLOGD("GetDeviceList, name=%s, type=%s", device.deviceName.c_str(), device.deviceType.c_str()); } sleep(1); // avoid thread dnet thread died, then will have pthread; } @@ -151,7 +151,7 @@ HWTEST_F(CommunicationProviderImplTest, CommunicationProvider007, TestSize.Level auto device = CommunicationProvider::GetInstance().GetLocalDevice(); const unsigned long val = 0; ASSERT_GE(device.deviceName.length(), val); - ZLOGD("GetLocalDevice, name:%s, type:%s", device.deviceName.c_str(), device.deviceType.c_str()); + ZLOGD("GetLocalDevice, name=%s, type=%s", device.deviceName.c_str(), device.deviceType.c_str()); sleep(1); // avoid thread dnet thread died, then will have pthread; } diff --git a/services/distributeddataservice/adapter/dfx/src/dds_trace.cpp b/services/distributeddataservice/adapter/dfx/src/dds_trace.cpp index bf8b93a4d51ae04e6271c74ecc8ba80f33cc127d..39f3f3d21303f9cf950672137b03d5e1e89d702e 100644 --- a/services/distributeddataservice/adapter/dfx/src/dds_trace.cpp +++ b/services/distributeddataservice/adapter/dfx/src/dds_trace.cpp @@ -63,7 +63,7 @@ void DdsTrace::Start(const std::string& value) if ((switchOption & API_PERFORMANCE_TRACE_ON) == API_PERFORMANCE_TRACE_ON) { lastTime = TimeUtils::CurrentTimeMicros(); } - ZLOGD("DdsTrace-Start: Trace[%{public}u] %{public}s In", traceCount, value.c_str()); + ZLOGD("DdsTrace-Start: Trace[traceCount=%{public}u], value = %{public}s In", traceCount, value.c_str()); } void DdsTrace::Middle(const std::string& beforeValue, const std::string& afterValue) @@ -74,7 +74,7 @@ void DdsTrace::Middle(const std::string& beforeValue, const std::string& afterVa if (switchOption & BYTRACE_ON) { MiddleTrace(BYTRACE_LABEL, beforeValue, afterValue); } - ZLOGD("DdsTrace-Middle: Trace[%{public}u] %{public}s --- %{public}s", traceCount, + ZLOGD("DdsTrace-Middle: Trace[traceCount=%{public}u], bvalue=%{public}s, avalue=%{public}s", traceCount, beforeValue.c_str(), afterValue.c_str()); } @@ -93,7 +93,7 @@ void DdsTrace::Finish(const std::string& value) Reporter::GetInstance()->ApiPerformanceStatistic()->Report({value, delta, delta, delta}); } } - ZLOGD("DdsTrace-Finish: Trace[%u] %{public}s Out: %{public}" PRIu64"us.", traceCount, value.c_str(), delta); + ZLOGD("DdsTrace-Finish: Trace=%u value=%{public}s Out=%{public}" PRIu64"us.", traceCount, value.c_str(), delta); } bool DdsTrace::SetBytraceEnable() @@ -106,7 +106,7 @@ bool DdsTrace::SetBytraceEnable() isSetBytraceEnabled = true; DdsTrace::switchOption = DdsTrace::BYTRACE_ON | DdsTrace::API_PERFORMANCE_TRACE_ON; - ZLOGD("success, current tag is true"); + ZLOGD("successful, current tag is true"); return true; } } // namespace OHOS diff --git a/services/distributeddataservice/adapter/permission/src/meida_lib_checker.cpp b/services/distributeddataservice/adapter/permission/src/meida_lib_checker.cpp index eb63f84fe7d91efe79273878de694790039078b8..4795abc97dbb174e97466af5bfd51c8e1ce4f018 100644 --- a/services/distributeddataservice/adapter/permission/src/meida_lib_checker.cpp +++ b/services/distributeddataservice/adapter/permission/src/meida_lib_checker.cpp @@ -58,7 +58,7 @@ std::string MeidaLibChecker::GetAppId(pid_t uid, const std::string &bundleName) if (!success) { return ""; } - ZLOGD("orion: %{public}s, uid: %{public}d, bundle: %{public}s appId: %{public}s", orionBundle.c_str(), uid, + ZLOGD("orion = %{public}s, uid = %{public}d, bundle = %{public}s, appId = %{public}s", orionBundle.c_str(), uid, bundleName.c_str(), bundleInfo->appId.c_str()); return Crypto::Sha256(bundleInfo->appId); } diff --git a/services/distributeddataservice/adapter/permission/src/permission_validator.cpp b/services/distributeddataservice/adapter/permission/src/permission_validator.cpp index ed6f14b85f1e73d81aff4457949b902c56f796ed..73bc435a92baeecd5732f3ad3d0c4e89c9591f20 100644 --- a/services/distributeddataservice/adapter/permission/src/permission_validator.cpp +++ b/services/distributeddataservice/adapter/permission/src/permission_validator.cpp @@ -65,10 +65,10 @@ bool PermissionValidator::IsSystemService(const std::string &bundleName) { auto it = systemServiceList_.find(bundleName); if (it == systemServiceList_.end()) { - ZLOGD("bundleName:%s is not system service.", bundleName.c_str()); + ZLOGD("bundleName = %s is not system service.", bundleName.c_str()); return false; } - ZLOGD("bundleName:%s is system service.", bundleName.c_str()); + ZLOGD("bundleName = %s is system service.", bundleName.c_str()); return true; } @@ -81,7 +81,7 @@ bool PermissionValidator::IsAutoLaunchEnabled(const std::string &bundleName) return true; } } - ZLOGD("AppId:%s is not allowed.", bundleName.c_str()); + ZLOGD("AppId = %s is not allowed.", bundleName.c_str()); return false; } } // namespace DistributedKv diff --git a/services/distributeddataservice/app/src/backup_handler.cpp b/services/distributeddataservice/app/src/backup_handler.cpp index ac0eae47cf4690f10e7e8179bdb21067a16bb936..8ff83d5cb2781e5855f6928b32a29c9a3952e27c 100644 --- a/services/distributeddataservice/app/src/backup_handler.cpp +++ b/services/distributeddataservice/app/src/backup_handler.cpp @@ -116,7 +116,7 @@ void BackupHandler::SingleKvStoreBackup(const MetaData &metaData) DistributedDB::PragmaData data = static_cast(&autoSync); auto pragmaStatus = delegate->Pragma(DistributedDB::PragmaCmd::AUTO_SYNC, data); if (pragmaStatus != DistributedDB::DBStatus::OK) { - ZLOGE("pragmaStatus: %d", static_cast(pragmaStatus)); + ZLOGE("pragmaStatus = %d", static_cast(pragmaStatus)); } } ZLOGW("SingleKvStoreBackup export"); @@ -126,10 +126,10 @@ void BackupHandler::SingleKvStoreBackup(const MetaData &metaData) RenameFile(backupFullName, backupBackFullName); status = delegate->Export(backupFullName, dbOption.passwd); if (status == DistributedDB::DBStatus::OK) { - ZLOGD("SingleKvStoreBackup export success."); + ZLOGD("SingleKvStoreBackup export successful."); RemoveFile(backupBackFullName); } else { - ZLOGE("SingleKvStoreBackup export failed, status is %d.", status); + ZLOGE("SingleKvStoreBackup export failed, status = %d.", status); RenameFile(backupBackFullName, backupFullName); } } @@ -175,9 +175,9 @@ void BackupHandler::MultiKvStoreBackup(const MetaData &metaData) RenameFile(backupFullName, backupBackFullName); status = delegate->Export(backupFullName, option.passwd); if (status == DistributedDB::DBStatus::OK) { - ZLOGD("MultiKvStoreBackup export success."); + ZLOGD("MultiKvStoreBackup export successful."); RemoveFile(backupBackFullName); - ZLOGD("MultiKvStoreBackup export success."); + ZLOGD("MultiKvStoreBackup export successful."); } else { ZLOGE("MultiKvStoreBackup export failed."); RenameFile(backupBackFullName, backupFullName); @@ -201,7 +201,7 @@ bool BackupHandler::InitBackupPara(const MetaData &metaData, BackupPara &backupP DistributedDB::CipherPassword password; const std::vector &secretKey = metaData.secretKeyMetaData.secretKey; if (password.SetValue(secretKey.data(), secretKey.size()) != DistributedDB::CipherPassword::OK) { - ZLOGE("Set secret key value failed. len is (%d)", int32_t(secretKey.size())); + ZLOGE("Set secret key value failed. len = %d", int32_t(secretKey.size())); return false; } @@ -253,7 +253,7 @@ bool BackupHandler::SingleKvStoreRecover(MetaData &metaData, DistributedDB::KvSt GetHashedBackupName(backupName)}); DistributedDB::DBStatus dbStatus = delegate->Import(backupFullName, password); if (dbStatus == DistributedDB::DBStatus::OK) { - ZLOGI("SingleKvStoreRecover success."); + ZLOGI("SingleKvStoreRecover successful."); return true; } ZLOGI("SingleKvStoreRecover failed."); @@ -292,7 +292,7 @@ bool BackupHandler::MultiKvStoreRecover(MetaData &metaData, }); DistributedDB::DBStatus dbStatus = delegate->Import(backupFullName, password); if (dbStatus == DistributedDB::DBStatus::OK) { - ZLOGI("MultiKvStoreRecover success."); + ZLOGI("MultiKvStoreRecover successful."); return true; } ZLOGI("MultiKvStoreRecover failed."); @@ -331,7 +331,7 @@ bool BackupHandler::RenameFile(const std::string &oldPath, const std::string &ne return false; } if (rename(oldPath.c_str(), newPath.c_str()) != 0) { - ZLOGE("RenameFile: rename error, errno[%d].", errno); + ZLOGE("RenameFile: rename error, errno = %d.", errno); return false; } return true; @@ -345,7 +345,7 @@ bool BackupHandler::RemoveFile(const std::string &path) } if (unlink(path.c_str()) != 0 && (errno != ENOENT)) { - ZLOGE("RemoveFile: failed to RemoveFile, errno[%d].", errno); + ZLOGE("RemoveFile: failed to RemoveFile, errno = %d.", errno); return false; } return true; @@ -379,7 +379,7 @@ bool BackupHandler::CheckNeedBackup() if (batteryPluggedType != PowerMgr::BatteryPluggedType::PLUGGED_TYPE_AC && batteryPluggedType != PowerMgr::BatteryPluggedType::PLUGGED_TYPE_USB && batteryPluggedType != PowerMgr::BatteryPluggedType::PLUGGED_TYPE_WIRELESS) { - ZLOGE("the device is not in charge full statue, the batteryPluggedType is %{public}d.", batteryPluggedType); + ZLOGE("the device is not in charge full statue, the batteryPluggedType = %{public}d.", batteryPluggedType); return false; } } @@ -390,7 +390,7 @@ bool BackupHandler::CheckNeedBackup() } uint64_t currentTime = TimeUtils::CurrentTimeMicros(); if (currentTime - backupSuccessTime_ < 36000000 && backupSuccessTime_ > 0) { // 36000000 is 10 hours - ZLOGE("no more than 10 hours since the last backup success."); + ZLOGE("no more than 10 hours since the last backup successful."); return false; } #endif diff --git a/services/distributeddataservice/app/src/device_change_listener_impl.cpp b/services/distributeddataservice/app/src/device_change_listener_impl.cpp index 5c20344169e0ee07e8b129efae8cc90b428505d1..3855ee75710ec07236a5e86976af648b106b327e 100644 --- a/services/distributeddataservice/app/src/device_change_listener_impl.cpp +++ b/services/distributeddataservice/app/src/device_change_listener_impl.cpp @@ -31,8 +31,8 @@ void DeviceChangeListenerImpl::OnDeviceChanged(const AppDistributedKv::DeviceInf DeviceChangeType deviceType = type == AppDistributedKv::DeviceChangeType::DEVICE_ONLINE ? DeviceChangeType::DEVICE_ONLINE : DeviceChangeType::DEVICE_OFFLINE; auto nodeid = KvStoreUtils::GetProviderInstance().ToNodeId(info.deviceId); - ZLOGD("networkid:%s", nodeid.c_str()); - ZLOGD("uuid:%s", KvStoreUtils::ToBeAnonymous(info.deviceId).c_str()); + ZLOGD("networkid=%s", nodeid.c_str()); + ZLOGD("uuid=%s", KvStoreUtils::ToBeAnonymous(info.deviceId).c_str()); for (auto const &observer : observers_) { observer.second->OnChange({nodeid, info.deviceName, info.deviceType}, deviceType); } diff --git a/services/distributeddataservice/app/src/kvstore_account_observer.cpp b/services/distributeddataservice/app/src/kvstore_account_observer.cpp index ae25f382f965bc96f2d38aca3a6d6fe7f21b6032..c63a6e94c34e1e3a999ed3dacff265fc8f2080e9 100644 --- a/services/distributeddataservice/app/src/kvstore_account_observer.cpp +++ b/services/distributeddataservice/app/src/kvstore_account_observer.cpp @@ -26,13 +26,13 @@ namespace DistributedKv { std::atomic g_kvStoreAccountEventStatus {0}; void KvStoreAccountObserver::OnAccountChanged(const AccountEventInfo &eventInfo) { - ZLOGI("account event %d, begin.", eventInfo.status); + ZLOGI("account event status = %d, begin.", eventInfo.status); KvStoreTask task([this, eventInfo]() { ZLOGI("account event processing in thread"); kvStoreDataService_.AccountEventChanged(eventInfo); }); DistributedData::ExecutorFactory::GetInstance().Execute(std::move(task)); - ZLOGI("account event %d, end.", eventInfo.status); + ZLOGI("account event status = %d, end.", eventInfo.status); } } // namespace DistributedKv } // namespace OHOS \ No newline at end of file diff --git a/services/distributeddataservice/app/src/kvstore_app_accessor.cpp b/services/distributeddataservice/app/src/kvstore_app_accessor.cpp index 40af4e48db31be826efcf7df389e4d8ded74c300..fef122a6f59825df5fc9ea3067824b420dc704cd 100644 --- a/services/distributeddataservice/app/src/kvstore_app_accessor.cpp +++ b/services/distributeddataservice/app/src/kvstore_app_accessor.cpp @@ -55,10 +55,10 @@ void KvStoreAppAccessor::EnableKvStoreAutoLaunch(const AppAccessorParam ¶m) param.storeId, param.launchOption, callback); if (dbStatus == DistributedDB::DBStatus::OK || dbStatus == DistributedDB::DBStatus::ALREADY_SET) { - ZLOGI("AppId:%s enable auto launch success.", param.appId.c_str()); + ZLOGI("AppId = %s enable auto launch successful.", param.appId.c_str()); return; } - ZLOGW("AppId:%s enable auto launch failed.", param.appId.c_str()); + ZLOGW("AppId = %s enable auto launch failed.", param.appId.c_str()); } void KvStoreAppAccessor::EnableKvStoreAutoLaunch() @@ -68,7 +68,7 @@ void KvStoreAppAccessor::EnableKvStoreAutoLaunch() if (KvStoreMetaManager::GetInstance().GetFullMetaData(entries)) { for (auto &meta : entries) { KvStoreMetaData &metaData = meta.second.kvStoreMetaData; - ZLOGI("meta appId:%s", metaData.appId.c_str()); + ZLOGI("meta appId = %s", metaData.appId.c_str()); if (!PermissionValidator::IsAutoLaunchEnabled(metaData.appId)) { continue; } @@ -112,12 +112,12 @@ void KvStoreAppAccessor::OnCallback(const std::string &userId, const std::string KvStoreMetaData kvStoreMetaData; if (KvStoreMetaManager::GetInstance().GetKvStoreMetaDataByAppId(appId, kvStoreMetaData)) { BroadcastSender::GetInstance()->SendEvent({userId, kvStoreMetaData.bundleName, storeId}); - ZLOGW("AppId:%s is opened, bundle:%s.", appId.c_str(), kvStoreMetaData.bundleName.c_str()); + ZLOGW("AppId = %s is opened, bundle = %s.", appId.c_str(), kvStoreMetaData.bundleName.c_str()); } else { - ZLOGW("AppId:%s open failed.", appId.c_str()); + ZLOGW("AppId = %s open failed.", appId.c_str()); } } else { - ZLOGD("AppId:%s is closed.", appId.c_str()); + ZLOGD("AppId = %s is closed.", appId.c_str()); } } } diff --git a/services/distributeddataservice/app/src/kvstore_app_manager.cpp b/services/distributeddataservice/app/src/kvstore_app_manager.cpp index c8c9af74d9ffea29161b23fe980df17177cfcef5..4425f067b189abed783f09571145a4ea582c1977 100644 --- a/services/distributeddataservice/app/src/kvstore_app_manager.cpp +++ b/services/distributeddataservice/app/src/kvstore_app_manager.cpp @@ -69,7 +69,7 @@ KvStoreAppManager::~KvStoreAppManager() Status KvStoreAppManager::ConvertErrorStatus(DistributedDB::DBStatus dbStatus, bool createIfMissing) { if (dbStatus != DistributedDB::DBStatus::OK) { - ZLOGE("delegate return error: %d.", static_cast(dbStatus)); + ZLOGE("delegate return error = %d.", static_cast(dbStatus)); switch (dbStatus) { case DistributedDB::DBStatus::INVALID_PASSWD_OR_CORRUPTED_DB: return Status::CRYPT_ERROR; @@ -102,7 +102,7 @@ Status KvStoreAppManager::GetKvStore(const Options &options, const std::string & PathType type = ConvertPathType(uid_, bundleName_, options.securityLevel); auto *delegateManager = GetDelegateManager(type); if (delegateManager == nullptr) { - ZLOGE("delegateManagers[%d] is nullptr.", type); + ZLOGE("delegateManagers = %d is nullptr.", type); return Status::ILLEGAL_STATE; } @@ -115,13 +115,13 @@ Status KvStoreAppManager::GetKvStore(const Options &options, const std::string & auto it = stores_[type].find(storeId); if (it != stores_[type].end()) { kvStore = it->second; - ZLOGI("find store in map refcount: %d.", kvStore->GetSptrRefCount()); + ZLOGI("find store in map refcount = %d.", kvStore->GetSptrRefCount()); kvStore->IncreaseOpenCount(); return Status::SUCCESS; } if ((GetTotalKvStoreNum()) >= static_cast(Constant::MAX_OPEN_KVSTORES)) { - ZLOGE("limit %d KvStores can be opened.", Constant::MAX_OPEN_KVSTORES); + ZLOGE("limit KvStores = %d can be opened.", Constant::MAX_OPEN_KVSTORES); return Status::ERROR; } @@ -141,7 +141,7 @@ Status KvStoreAppManager::GetKvStore(const Options &options, const std::string & }); if (storeDelegate == nullptr) { - ZLOGE("storeDelegate is nullptr, status:%d.", static_cast(dbStatusTmp)); + ZLOGE("storeDelegate is nullptr, status = %d.", static_cast(dbStatusTmp)); return ConvertErrorStatus(dbStatusTmp, options.createIfMissing); } @@ -161,7 +161,7 @@ Status KvStoreAppManager::GetKvStore(const Options &options, const std::string & return Status::ERROR; } - ZLOGD("after emplace refcount: %d", kvStore->GetSptrRefCount()); + ZLOGD("after emplace refcount = %d", kvStore->GetSptrRefCount()); return Status::SUCCESS; } @@ -173,7 +173,7 @@ Status KvStoreAppManager::GetKvStore(const Options &options, const std::string & PathType type = ConvertPathType(uid_, bundleName_, options.securityLevel); auto *delegateManager = GetDelegateManager(type); if (delegateManager == nullptr) { - ZLOGE("delegateManagers[%d] is nullptr.", type); + ZLOGE("delegateManagers type = %d is nullptr.", type); return Status::ILLEGAL_STATE; } @@ -185,7 +185,7 @@ Status KvStoreAppManager::GetKvStore(const Options &options, const std::string & auto it = singleStores_[type].find(storeId); if (it != singleStores_[type].end()) { kvStore = it->second; - ZLOGI("find store in map refcount: %d.", kvStore->GetSptrRefCount()); + ZLOGI("find store in map refcount = %d.", kvStore->GetSptrRefCount()); kvStore->IncreaseOpenCount(); return Status::SUCCESS; } @@ -240,13 +240,13 @@ Status KvStoreAppManager::GetKvStore(const Options &options, const std::string & return Status::ERROR; } - ZLOGI("after emplace refcount: %d autoSync: %d", kvStore->GetSptrRefCount(), static_cast(options.autoSync)); + ZLOGI("after emplace refcount = %d, autoSync = %d", kvStore->GetSptrRefCount(), static_cast(options.autoSync)); if (options.autoSync) { bool autoSync = true; DistributedDB::PragmaData data = static_cast(&autoSync); auto pragmaStatus = storeDelegate->Pragma(DistributedDB::PragmaCmd::AUTO_SYNC, data); if (pragmaStatus != DistributedDB::DBStatus::OK) { - ZLOGE("pragmaStatus: %d", static_cast(pragmaStatus)); + ZLOGE("pragmaStatus = %d", static_cast(pragmaStatus)); } } @@ -290,7 +290,7 @@ Status KvStoreAppManager::CloseAllKvStore() return Status::STORE_NOT_OPEN; } - ZLOGI("close %zu KvStores.", GetTotalKvStoreNum()); + ZLOGI("close KvStores = %zu.", GetTotalKvStoreNum()); Status status = CloseAllKvStore(PATH_DE); if (status == Status::DB_ERROR) { return status; @@ -327,16 +327,16 @@ Status KvStoreAppManager::DeleteAllKvStore() if (GetTotalKvStoreNum() == 0) { return Status::STORE_NOT_OPEN; } - ZLOGI("delete %d KvStores.", int32_t(GetTotalKvStoreNum())); + ZLOGI("delete KvStores = %d.", int32_t(GetTotalKvStoreNum())); Status status = DeleteAllKvStore(PATH_DE); if (status != Status::SUCCESS) { - ZLOGE("path de delegate delete error: %d.", static_cast(status)); + ZLOGE("path de delegate delete error = %d.", static_cast(status)); return Status::DB_ERROR; } status = DeleteAllKvStore(PATH_CE); if (status != Status::SUCCESS) { - ZLOGE("path ce delegate delete error: %d.", static_cast(status)); + ZLOGE("path ce delegate delete error = %d.", static_cast(status)); return Status::DB_ERROR; } return Status::SUCCESS; @@ -452,7 +452,7 @@ DistributedDB::KvStoreDelegateManager *KvStoreAppManager::GetDelegateManager(Pat std::string directory = GetDataStoragePath(deviceAccountId_, bundleName_, type); bool ret = ForceCreateDirectory(directory); if (!ret) { - ZLOGE("create directory[%s] failed, errstr=[%d].", directory.c_str(), errno); + ZLOGE("create directory = %s failed, errstr=%d.", directory.c_str(), errno); return nullptr; } // change mode for directories to 0755, and for files to 0600. @@ -462,15 +462,15 @@ DistributedDB::KvStoreDelegateManager *KvStoreAppManager::GetDelegateManager(Pat trueAppId_ = CheckerManager::GetInstance().GetAppId(bundleName_, uid_); if (trueAppId_.empty()) { delegateManagers_[type] = nullptr; - ZLOGW("check bundleName:%{public}s uid:%{public}d failed.", bundleName_.c_str(), uid_); + ZLOGW("check bundleName = %{public}s uid = %{public}d failed.", bundleName_.c_str(), uid_); return nullptr; } userId_ = AccountDelegate::GetInstance()->GetCurrentAccountId(bundleName_); - ZLOGD("accountId: %{public}s bundleName: %{public}s", deviceAccountId_.c_str(), bundleName_.c_str()); + ZLOGD("accountId = %{public}s bundleName = %{public}s", deviceAccountId_.c_str(), bundleName_.c_str()); delegateManagers_[type] = new (std::nothrow) DistributedDB::KvStoreDelegateManager(trueAppId_, deviceAccountId_); if (delegateManagers_[type] == nullptr) { - ZLOGE("delegateManagers_[%d] is nullptr.", type); + ZLOGE("delegateManagers_ type = %d is nullptr.", type); return nullptr; } @@ -493,7 +493,7 @@ Status KvStoreAppManager::CloseKvStore(const std::string &storeId, PathType type { auto *delegateManager = GetDelegateManager(type); if (delegateManager == nullptr) { - ZLOGE("delegateManager[%d] is null.", type); + ZLOGE("delegateManager type = %d is null.", type); return Status::ILLEGAL_STATE; } @@ -508,7 +508,7 @@ Status KvStoreAppManager::CloseKvStore(const std::string &storeId, PathType type if (status == InnerStatus::DECREASE_REFCOUNT) { return Status::SUCCESS; } - ZLOGE("delegate close error: %d.", static_cast(status)); + ZLOGE("delegate close error = %d.", static_cast(status)); return Status::DB_ERROR; } @@ -523,7 +523,7 @@ Status KvStoreAppManager::CloseKvStore(const std::string &storeId, PathType type if (status == InnerStatus::DECREASE_REFCOUNT) { return Status::SUCCESS; } - ZLOGE("delegate close error: %d.", static_cast(status)); + ZLOGE("delegate close error = %d.", static_cast(status)); return Status::DB_ERROR; } @@ -534,16 +534,16 @@ Status KvStoreAppManager::CloseAllKvStore(PathType type) { auto *delegateManager = GetDelegateManager(type); if (delegateManager == nullptr) { - ZLOGE("delegateManager[%d] is null.", type); + ZLOGE("delegateManager type = %d is null.", type); return Status::ILLEGAL_STATE; } for (auto it = stores_[type].begin(); it != stores_[type].end(); it = stores_[type].erase(it)) { KvStoreImpl *currentStore = it->second.GetRefPtr(); - ZLOGI("close kvstore, refcount %d.", it->second->GetSptrRefCount()); + ZLOGI("close kvstore, refcount = %d.", it->second->GetSptrRefCount()); Status status = currentStore->ForceClose(delegateManager); if (status != Status::SUCCESS) { - ZLOGE("delegate close error: %d.", static_cast(status)); + ZLOGE("delegate close error = %d.", static_cast(status)); return Status::DB_ERROR; } } @@ -551,10 +551,10 @@ Status KvStoreAppManager::CloseAllKvStore(PathType type) for (auto it = singleStores_[type].begin(); it != singleStores_[type].end(); it = singleStores_[type].erase(it)) { SingleKvStoreImpl *currentStore = it->second.GetRefPtr(); - ZLOGI("close kvstore, refcount %d.", it->second->GetSptrRefCount()); + ZLOGI("close kvstore, refcount = %d.", it->second->GetSptrRefCount()); Status status = currentStore->ForceClose(delegateManager); if (status != Status::SUCCESS) { - ZLOGE("delegate close error: %d.", static_cast(status)); + ZLOGE("delegate close error = %d.", static_cast(status)); return Status::DB_ERROR; } } @@ -566,7 +566,7 @@ Status KvStoreAppManager::DeleteKvStore(const std::string &storeId, PathType typ { auto *delegateManager = GetDelegateManager(type); if (delegateManager == nullptr) { - ZLOGE("delegateManager[%d] is null.", type); + ZLOGE("delegateManager type = %d is null.", type); return Status::ILLEGAL_STATE; } std::lock_guard lg(storeMutex_); @@ -600,7 +600,7 @@ Status KvStoreAppManager::DeleteAllKvStore(PathType type) { auto *delegateManager = GetDelegateManager(type); if (delegateManager == nullptr) { - ZLOGE("delegateManager[%d] is null.", type); + ZLOGE("delegateManager type = %d is null.", type); return Status::ILLEGAL_STATE; } @@ -609,14 +609,14 @@ Status KvStoreAppManager::DeleteAllKvStore(PathType type) KvStoreImpl *currentStore = it->second.GetRefPtr(); Status status = currentStore->ForceClose(delegateManager); if (status != Status::SUCCESS) { - ZLOGE("delegate delete close failed error: %d.", static_cast(status)); + ZLOGE("delegate delete close failed error =%d.", static_cast(status)); return Status::DB_ERROR; } - ZLOGI("delete kvstore, refcount %d.", it->second->GetSptrRefCount()); + ZLOGI("delete kvstore, refcount = %d.", it->second->GetSptrRefCount()); DistributedDB::DBStatus dbStatus = delegateManager->DeleteKvStore(storeId); if (dbStatus != DistributedDB::DBStatus::OK) { - ZLOGE("delegate delete error: %d.", static_cast(dbStatus)); + ZLOGE("delegate delete error = %d.", static_cast(dbStatus)); return Status::DB_ERROR; } } @@ -627,14 +627,14 @@ Status KvStoreAppManager::DeleteAllKvStore(PathType type) SingleKvStoreImpl *currentStore = it->second.GetRefPtr(); Status status = currentStore->ForceClose(delegateManager); if (status != Status::SUCCESS) { - ZLOGE("delegate delete close failed error: %d.", static_cast(status)); + ZLOGE("delegate delete close failed error = %d.", static_cast(status)); return Status::DB_ERROR; } - ZLOGI("close kvstore, refcount %d.", it->second->GetSptrRefCount()); + ZLOGI("close kvstore, refcount = %d.", it->second->GetSptrRefCount()); DistributedDB::DBStatus dbStatus = delegateManager->DeleteKvStore(storeId); if (dbStatus != DistributedDB::DBStatus::OK) { - ZLOGE("delegate delete error: %d.", static_cast(dbStatus)); + ZLOGE("delegate delete error = %d.", static_cast(dbStatus)); return Status::DB_ERROR; } } @@ -660,7 +660,7 @@ Status KvStoreAppManager::MigrateAllKvStore(const std::string &harmonyAccountId, sptr impl = it.second; if (impl->MigrateKvStore(harmonyAccountId, dirPath, delegateManager, newDelegateManager) != Status::SUCCESS) { status = Status::MIGRATION_KVSTORE_FAILED; - ZLOGE("migrate kvstore for appId-%s failed.", bundleName_.c_str()); + ZLOGE("migrate kvstore for appId- = %s failed.", bundleName_.c_str()); // skip this failed, continue to migrate other kvstore. } } @@ -670,7 +670,7 @@ Status KvStoreAppManager::MigrateAllKvStore(const std::string &harmonyAccountId, sptr impl = it.second; if (impl->MigrateKvStore(harmonyAccountId, dirPath, delegateManager, newDelegateManager) != Status::SUCCESS) { status = Status::MIGRATION_KVSTORE_FAILED; - ZLOGE("migrate single kvstore for appId-%s failed.", bundleName_.c_str()); + ZLOGE("migrate single kvstore for appId- = %s failed.", bundleName_.c_str()); // skip this failed, continue to migrate other kvstore. } } diff --git a/services/distributeddataservice/app/src/kvstore_data_service.cpp b/services/distributeddataservice/app/src/kvstore_data_service.cpp index 40b0c5f8e0e56e664fbac562b50cfcbe9ec6ca6b..c21f665d9700a702986747b593c0778f75e247aa 100644 --- a/services/distributeddataservice/app/src/kvstore_data_service.cpp +++ b/services/distributeddataservice/app/src/kvstore_data_service.cpp @@ -102,13 +102,13 @@ void KvStoreDataService::Initialize() #endif auto communicator = std::make_shared(RouteHeadHandlerImpl::Create); auto ret = KvStoreDelegateManager::SetProcessCommunicator(communicator); - ZLOGI("set communicator ret:%{public}d.", static_cast(ret)); + ZLOGI("set communicator ret = %{public}d.", static_cast(ret)); auto syncActivationCheck = [this](const std::string &userId, const std::string &appId, const std::string &storeId) -> bool { return CheckSyncActivation(userId, appId, storeId); }; ret = DistributedDB::KvStoreDelegateManager::SetSyncActivationCheckCallback(syncActivationCheck); - ZLOGI("set sync activation check callback ret:%{public}d.", static_cast(ret)); + ZLOGI("set sync activation check callback ret = %{public}d.", static_cast(ret)); InitSecurityAdapter(); KvStoreMetaManager::GetInstance().InitMetaParameter(); @@ -121,7 +121,7 @@ void KvStoreDataService::Initialize() constexpr int RETRY_TIME_INTERVAL_MILLISECOND = 1 * 1000 * 1000; // retry after 1 second while (retryCount < RETRY_MAX_TIMES) { if (KvStoreMetaManager::GetInstance().GenerateRootKey() == Status::SUCCESS) { - ZLOGI("GenerateRootKey success."); + ZLOGI("GenerateRootKey successful."); break; } retryCount++; @@ -153,7 +153,7 @@ Status KvStoreDataService::GetKvStore(const Options &options, const AppId &appId const int32_t uid = IPCSkeleton::GetCallingUid(); param.trueAppId = CheckerManager::GetInstance().GetAppId(appId.appId, uid); if (param.trueAppId.empty()) { - ZLOGW("appId:%{public}s, uid:%{public}d, PERMISSION_DENIED", appId.appId.c_str(), uid); + ZLOGW("appId = %{public}s, uid = %{public}d, PERMISSION_DENIED", appId.appId.c_str(), uid); return Status::PERMISSION_DENIED; } @@ -186,7 +186,7 @@ Status KvStoreDataService::GetKvStore(const Options &options, const AppId &appId KvStoreAppManager::ConvertPathType(param.uid, param.bundleName, options.securityLevel), store); } - ZLOGD("get kvstore return status:%d, userId:[%s], bundleName:[%s].", + ZLOGD("get kvstore return status = %d, userId = %s, bundleName = %s.", param.status, KvStoreUtils::ToBeAnonymous(param.userId).c_str(), appId.appId.c_str()); if (param.status == Status::SUCCESS) { callback(std::move(store)); @@ -263,9 +263,9 @@ Status KvStoreDataService::FillStoreParam( param.storeId = storeId.storeId; param.uid = IPCSkeleton::GetCallingUid(); param.trueAppId = CheckerManager::GetInstance().GetAppId(appId.appId, param.uid); - ZLOGI("%{public}s, %{public}s", param.trueAppId.c_str(), param.bundleName.c_str()); + ZLOGI("trueAppId = %{public}s, bundleName = %{public}s", param.trueAppId.c_str(), param.bundleName.c_str()); if (param.trueAppId.empty()) { - ZLOGW("appId:%{public}s, uid:%{public}d, PERMISSION_DENIED", appId.appId.c_str(), param.uid); + ZLOGW("appId = %{public}s, uid = %{public}d, PERMISSION_DENIED", appId.appId.c_str(), param.uid); return PERMISSION_DENIED; } @@ -392,7 +392,7 @@ Status KvStoreDataService::GetKvStoreFailDo(const Options &options, const KvStor Status statusTmp = kvParas.status; Status getKvStoreStatus = statusTmp; int32_t path = KvStoreAppManager::ConvertPathType(kvParas.uid, kvParas.bundleName, options.securityLevel); - ZLOGW("getKvStore failed with status %d", static_cast(getKvStoreStatus)); + ZLOGW("getKvStore failed with status = %d", static_cast(getKvStoreStatus)); if (getKvStoreStatus == Status::CRYPT_ERROR && options.encrypt) { if (secKeyParas.alreadyCreated != Status::SUCCESS) { // create encrypted store failed, remove secret key @@ -437,7 +437,7 @@ Status KvStoreDataService::GetSingleKvStoreFailDo(const Options &options, const Status statusTmp = kvParas.status; Status getKvStoreStatus = statusTmp; int32_t path = KvStoreAppManager::ConvertPathType(kvParas.uid, kvParas.bundleName, options.securityLevel); - ZLOGW("getKvStore failed with status %d", static_cast(getKvStoreStatus)); + ZLOGW("getKvStore failed with status = %d", static_cast(getKvStoreStatus)); if (getKvStoreStatus == Status::CRYPT_ERROR && options.encrypt) { if (secKeyParas.alreadyCreated != Status::SUCCESS) { // create encrypted store failed, remove secret key @@ -490,7 +490,7 @@ bool KvStoreDataService::CheckOptions(const Options &options, const std::vector< ZLOGE("get metaKey failed."); return false; } - ZLOGI("metaData encrypt is %d, kvStore type is %d, options encrypt is %d, kvStore type is %d", + ZLOGI("metaData encrypt = %d, kvStore type = %d, options encrypt = %d, kvStore type = %d", static_cast(metaData.isEncrypt), static_cast(metaData.kvStoreType), static_cast(options.encrypt), static_cast(options.kvStoreType)); if (options.encrypt != metaData.isEncrypt) { @@ -549,7 +549,7 @@ Status KvStoreDataService::RecoverKvStore(const Options &options, const std::str ZLOGE("RecoverSingleKvStore Import failed."); return Status::RECOVER_FAILED; } - ZLOGD("RecoverSingleKvStore Import success."); + ZLOGD("RecoverSingleKvStore Import successful."); return Status::RECOVER_SUCCESS; } @@ -583,7 +583,7 @@ void KvStoreDataService::GetAllKvStoreId( DdsTrace traceDelegate(std::string(LOG_TAG "Delegate::") + std::string(__FUNCTION__)); dbStatus = metaKvStoreDelegate->GetEntries(dbKey, dbEntries); if (dbStatus != DistributedDB::DBStatus::OK) { - ZLOGE("GetEntries delegate return error: %d.", static_cast(dbStatus)); + ZLOGE("GetEntries delegate return error = %d.", static_cast(dbStatus)); if (dbEntries.empty()) { callback(Status::SUCCESS, storeIdList); } else { @@ -617,7 +617,7 @@ Status KvStoreDataService::CloseKvStore(const AppId &appId, const StoreId &store const int32_t uid = IPCSkeleton::GetCallingUid(); std::string trueAppId = CheckerManager::GetInstance().GetAppId(appId.appId, uid); if (trueAppId.empty()) { - ZLOGW("check appId:%{public}s uid:%{public}d failed.", appId.appId.c_str(), uid); + ZLOGW("check appId = %{public}s uid = %{public}d failed.", appId.appId.c_str(), uid); return Status::PERMISSION_DENIED; } const std::string userId = AccountDelegate::GetInstance()->GetDeviceAccountIdByUID(uid); @@ -647,7 +647,7 @@ Status KvStoreDataService::CloseAllKvStore(const AppId &appId) const int32_t uid = IPCSkeleton::GetCallingUid(); std::string trueAppId = CheckerManager::GetInstance().GetAppId(appId.appId, uid); if (trueAppId.empty()) { - ZLOGW("check appId:%{public}s uid:%{public}d failed.", appId.appId.c_str(), uid); + ZLOGW("check appId = %{public}s uid = %{public}d failed.", appId.appId.c_str(), uid); return Status::PERMISSION_DENIED; } @@ -706,7 +706,7 @@ Status KvStoreDataService::DeleteAllKvStore(const AppId &appId) int32_t uid = IPCSkeleton::GetCallingUid(); if (!CheckerManager::GetInstance().IsValid(appId.appId, uid)) { - ZLOGE("check appId:%{public}s uid:%{public}d failed.", appId.appId.c_str(), uid); + ZLOGE("check appId = %{public}s uid = %{public}d failed.", appId.appId.c_str(), uid); return Status::PERMISSION_DENIED; } @@ -718,14 +718,14 @@ Status KvStoreDataService::DeleteAllKvStore(const AppId &appId) }); if (statusTmp != Status::SUCCESS) { - ZLOGE("%s, error: %d ", appId.appId.c_str(), static_cast(statusTmp)); + ZLOGE("appId = %s, error = %d ", appId.appId.c_str(), static_cast(statusTmp)); return statusTmp; } for (const auto &storeId : existStoreIds) { statusTmp = DeleteKvStore(appId, storeId); if (statusTmp != Status::SUCCESS) { - ZLOGE("%s, error: %d ", appId.appId.c_str(), static_cast(statusTmp)); + ZLOGE("appId = %s, error = %d ", appId.appId.c_str(), static_cast(statusTmp)); return statusTmp; } } @@ -745,14 +745,14 @@ Status KvStoreDataService::RegisterClientDeathObserver(const AppId &appId, sptr< int32_t uid = IPCSkeleton::GetCallingUid(); if (!CheckerManager::GetInstance().IsValid(appId.appId, uid)) { - ZLOGE("no permission bundleName:%{public}s, uid:%{public}d.", appId.appId.c_str(), uid); + ZLOGE("no permission bundleName = %{public}s, uid = %{public}d.", appId.appId.c_str(), uid); return Status::PERMISSION_DENIED; } std::lock_guard lg(clientDeathObserverMutex_); auto it = clientDeathObserverMap_.emplace(std::piecewise_construct, std::forward_as_tuple(appId.appId), std::forward_as_tuple(appId, uid, *this, std::move(observer))); - ZLOGI("map size: %{public}zu.", clientDeathObserverMap_.size()); + ZLOGI("map size = %{public}zu.", clientDeathObserverMap_.size()); if (!it.second) { ZLOGI("insert failed"); return Status::ERROR; @@ -774,12 +774,12 @@ Status KvStoreDataService::AppExit(const AppId &appId, pid_t uid) { std::lock_guard lg(clientDeathObserverMutex_); clientDeathObserverMap_.erase(appIdTmp.appId); - ZLOGI("map size: %zu.", clientDeathObserverMap_.size()); + ZLOGI("map size = %zu.", clientDeathObserverMap_.size()); } std::string trueAppId = CheckerManager::GetInstance().GetAppId(appIdTmp.appId, uid); if (trueAppId.empty()) { - ZLOGW("check appId:%{public}s uid:%{public}d failed.", appIdTmp.appId.c_str(), uid); + ZLOGW("check appId = %{public}s uid = %{public}d failed.", appIdTmp.appId.c_str(), uid); return Status::PERMISSION_DENIED; } const std::string userId = AccountDelegate::GetInstance()->GetCurrentAccountId(appIdTmp.appId); @@ -803,9 +803,9 @@ int KvStoreDataService::Dump(int fd, const std::vector &args) return 0; } dprintf(fd, "------------------------------------------------------------------\n"); - dprintf(fd, "DeviceAccount count : %u\n", static_cast(deviceAccountMap_.size())); + dprintf(fd, "DeviceAccount count = %u\n", static_cast(deviceAccountMap_.size())); for (const auto &pair : deviceAccountMap_) { - dprintf(fd, "DeviceAccountID : %s\n", pair.first.c_str()); + dprintf(fd, "DeviceAccountID = %s\n", pair.first.c_str()); pair.second.Dump(fd); } return 0; @@ -876,7 +876,7 @@ void KvStoreDataService::StartService() #endif std::string backupPath = BackupHandler::GetBackupPath( AccountDelegate::GetInstance()->GetDeviceAccountIdByUID(getuid()), KvStoreAppManager::PATH_DE); - ZLOGI("backupPath is : %s ", backupPath.c_str()); + ZLOGI("backupPath = %s ", backupPath.c_str()); if (!ForceCreateDirectory(backupPath)) { ZLOGE("backup create directory failed"); } @@ -894,7 +894,7 @@ void KvStoreDataService::StartService() [this](const std::string &userId, const std::string &appId, const std::string &storeId, const std::string &deviceId, uint8_t flag) -> bool { // temp add permission whilelist for ddmp; this should be config in ddmp manifest. - ZLOGD("checking sync permission start appid:%s, stid:%s.", appId.c_str(), storeId.c_str()); + ZLOGD("checking sync permission start appid=%s, stid=%s.", appId.c_str(), storeId.c_str()); return CheckPermissions(userId, appId, storeId, deviceId, flag); }; auto dbStatus = KvStoreDelegateManager::SetPermissionCheckCallback(permissionCheckCallback); @@ -916,7 +916,7 @@ void KvStoreDataService::StartService() KvStoreAppAccessor::GetInstance().EnableKvStoreAutoLaunch(); }); th.detach(); - ZLOGI("Publish ret: %{public}d", static_cast(ret)); + ZLOGI("Publish ret = %{public}d", static_cast(ret)); } void KvStoreDataService::OnStoreMetaChanged( @@ -927,7 +927,7 @@ void KvStoreDataService::OnStoreMetaChanged( } StoreMetaData metaData; metaData.Unmarshall({ value.begin(), value.end() }); - ZLOGD("meta data info appType:%{public}s, storeId:%{public}s isDirty:%{public}d", metaData.appType.c_str(), + ZLOGD("meta data info appType=%{public}s, storeId=%{public}s isDirty=%{public}d", metaData.appType.c_str(), metaData.storeId.c_str(), metaData.isDirty); if (metaData.deviceId != DeviceKvStoreImpl::GetLocalDeviceId() || metaData.deviceId.empty()) { ZLOGD("ignore other device change or invalid meta device"); @@ -937,7 +937,7 @@ void KvStoreDataService::OnStoreMetaChanged( if (!metaData.isDirty || metaData.appType != HARMONY_APP) { return; } - ZLOGI("dirty kv store. storeId:%{public}s", metaData.storeId.c_str()); + ZLOGI("dirty kv store. storeId=%{public}s", metaData.storeId.c_str()); CloseKvStore({ metaData.bundleName }, { metaData.storeId }); DeleteKvStore({ metaData.bundleName }, { metaData.storeId }); } @@ -1023,7 +1023,7 @@ void KvStoreDataService::ResolveAutoLaunchCompatible(const MetaData &meta, const DistributedDB::KvStoreNbDelegate *store = nullptr; delegateManager->GetKvStore(storeMeta.storeId, dbOptions, [&identifier, &store, &storeMeta](int status, DistributedDB::KvStoreNbDelegate *delegate) { - ZLOGI("temporary open db for equal identifier, ret:%{public}d", status); + ZLOGI("temporary open db for equal identifier, ret=%{public}d", status); if (delegate != nullptr) { KvStoreTuple tuple = { storeMeta.deviceAccountId, storeMeta.appId, storeMeta.storeId }; UpgradeManager::SetCompatibleIdentifyByType(delegate, tuple, IDENTICAL_ACCOUNT_GROUP); @@ -1076,7 +1076,7 @@ bool KvStoreDataService::CheckPermissions(const std::string &userId, const std:: return true; } bool ret = PermissionValidator::CheckSyncPermission(userId, appId, metaData.uid); - ZLOGD("checking sync permission ret:%{public}d.", ret); + ZLOGD("checking sync permission ret=%{public}d.", ret); return ret; } @@ -1115,7 +1115,7 @@ KvStoreDataService::KvStoreClientDeathObserverImpl::~KvStoreClientDeathObserverI void KvStoreDataService::KvStoreClientDeathObserverImpl::NotifyClientDie() { - ZLOGI("appId: %{public}s uid:%{public}d", appId_.appId.c_str(), uid_); + ZLOGI("appId = %{public}s, uid = %{public}d", appId_.appId.c_str(), uid_); dataService_.AppExit(appId_, uid_); } @@ -1184,7 +1184,7 @@ Status KvStoreDataService::DeleteKvStoreOnly(const std::string &bundleName, pid_ void KvStoreDataService::AccountEventChanged(const AccountEventInfo &eventInfo) { - ZLOGI("account event %{public}d changed process, begin.", eventInfo.status); + ZLOGI("account event status = %{public}d changed process, begin.", eventInfo.status); std::lock_guard lg(accountMutex_); switch (eventInfo.status) { case AccountStatus::DEVICE_ACCOUNT_DELETE: { @@ -1209,14 +1209,14 @@ void KvStoreDataService::AccountEventChanged(const AccountEventInfo &eventInfo) } case AccountStatus::DEVICE_ACCOUNT_SWITCHED: { auto ret = DistributedDB::KvStoreDelegateManager::NotifyUserChanged(); - ZLOGI("notify delegate manager result:%{public}d", ret); + ZLOGI("notify delegate manager result = %{public}d", ret); break; } default: { break; } } - ZLOGI("account event %{public}d changed process, end.", eventInfo.status); + ZLOGI("account event status = %{public}d changed process, end.", eventInfo.status); } Status KvStoreDataService::GetLocalDevice(DeviceInfo &device) @@ -1233,14 +1233,14 @@ Status KvStoreDataService::GetDeviceList(std::vector &deviceInfoList DeviceInfo deviceInfo = {device.deviceId, device.deviceName, device.deviceType}; deviceInfoList.push_back(deviceInfo); } - ZLOGD("strategy is %{public}d.", strategy); + ZLOGD("strategy = %{public}d.", strategy); return Status::SUCCESS; } void KvStoreDataService::InitSecurityAdapter() { auto ret = DATASL_OnStart(); - ZLOGI("datasl on start ret:%d", ret); + ZLOGI("datasl on start ret = %d", ret); security_ = std::make_shared(); if (security_ == nullptr) { ZLOGD("Security is nullptr."); @@ -1248,11 +1248,11 @@ void KvStoreDataService::InitSecurityAdapter() } auto dbStatus = DistributedDB::KvStoreDelegateManager::SetProcessSystemAPIAdapter(security_); - ZLOGD("set distributed db system api adapter: %d.", static_cast(dbStatus)); + ZLOGD("set distributed db system api adapter = %d.", static_cast(dbStatus)); auto status = KvStoreUtils::GetProviderInstance().StartWatchDeviceChange(security_.get(), {"security"}); if (status != AppDistributedKv::Status::SUCCESS) { - ZLOGD("security register device change failed, status:%d", static_cast(status)); + ZLOGD("security register device change failed, status = %d", static_cast(status)); } } @@ -1271,7 +1271,7 @@ Status KvStoreDataService::StartWatchDeviceChange(sptrAsObject().GetRefPtr(); auto listenerPair = std::make_pair(objectPtr, observer); deviceListeners_.insert(listenerPair); - ZLOGD("strategy is %{public}d.", strategy); + ZLOGD("strategy = %{public}d.", strategy); return Status::SUCCESS; } @@ -1307,7 +1307,7 @@ void KvStoreDataService::SetCompatibleIdentify(const AppDistributedKv::DeviceInf bool KvStoreDataService::CheckSyncActivation( const std::string &userId, const std::string &appId, const std::string &storeId) { - ZLOGD("user:%{public}s, app:%{public}s, store:%{public}s", userId.c_str(), appId.c_str(), storeId.c_str()); + ZLOGD("user = %{public}s, app = %{public}s, store = %{public}s", userId.c_str(), appId.c_str(), storeId.c_str()); std::vector users = UserDelegate::GetInstance().GetLocalUserStatus(); // active sync feature with single active user for (const auto &user : users) { @@ -1320,7 +1320,7 @@ bool KvStoreDataService::CheckSyncActivation( continue; } if (IsStoreOpened(std::to_string(user.id), appId, storeId)) { - ZLOGD("the store already opened in user %{public}d", user.id); + ZLOGD("the store already opened in user id = %{public}d", user.id); return false; } } diff --git a/services/distributeddataservice/app/src/kvstore_impl.cpp b/services/distributeddataservice/app/src/kvstore_impl.cpp index 19a002fe4bf285add6a637b6d86c355af192b635..5e1067d92d84f33c2697bb8331dea42c1c9d7ed0 100644 --- a/services/distributeddataservice/app/src/kvstore_impl.cpp +++ b/services/distributeddataservice/app/src/kvstore_impl.cpp @@ -442,7 +442,7 @@ Status KvStoreImpl::ForceClose(DistributedDB::KvStoreDelegateManager *kvStoreDel { DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); - ZLOGI("start ForceClose, current openCount is %d.", openCount_); + ZLOGI("start ForceClose, current openCount = %d.", openCount_); KVSTORE_ACCOUNT_EVENT_PROCESSING_CHECKER(Status::SYSTEM_ACCOUNT_EVENT_PROCESSING); std::shared_lock lock(storeDelegateMutex_); if (kvStoreDelegate_ == nullptr || kvStoreDelegateManager == nullptr) { @@ -457,7 +457,7 @@ Status KvStoreImpl::ForceClose(DistributedDB::KvStoreDelegateManager *kvStoreDel delete *observer; observer = observerSet_.erase(observer); } else { - ZLOGW("Force close kvstore failed during UnRegisterObserver, status %d.", dbStatus); + ZLOGW("Force close kvstore failed during UnRegisterObserver, status = %d.", dbStatus); return Status::ERROR; } } @@ -468,7 +468,7 @@ Status KvStoreImpl::ForceClose(DistributedDB::KvStoreDelegateManager *kvStoreDel if (snapshotImpl != nullptr) { auto status = snapshotImpl->Release(kvStoreDelegate_); if (status != Status::SUCCESS) { - ZLOGW("Force close kvstore failed during release snapshot, errCode %d", status); + ZLOGW("Force close kvstore failed during release snapshot, errCode status = %d", status); return status; } } @@ -480,7 +480,7 @@ Status KvStoreImpl::ForceClose(DistributedDB::KvStoreDelegateManager *kvStoreDel ZLOGI("end ForceClose."); return Status::SUCCESS; } - ZLOGI("ForceClose close failed with error code %d.", status); + ZLOGI("ForceClose close failed with error code status = %d.", status); return Status::ERROR; } @@ -539,26 +539,26 @@ Status KvStoreImpl::MigrateKvStore(const std::string &harmonyAccountId, }); if (kvStoreDelegate == nullptr) { - ZLOGE("storeDelegate is nullptr, dbStatusTmp: %d", static_cast(dbStatus)); + ZLOGE("storeDelegate is nullptr, dbStatusTmp = %d", static_cast(dbStatus)); return Status::DB_ERROR; } status = RebuildKvStoreObserver(kvStoreDelegate); if (status != Status::SUCCESS) { - ZLOGI("rebuild KvStore observer failed, errCode %d.", static_cast(status)); + ZLOGI("rebuild KvStore observer failed, errCode status = %d.", static_cast(status)); // skip this failed, continue to do other rebuild process. } status = RebuildKvStoreSnapshot(kvStoreDelegate); if (status != Status::SUCCESS) { - ZLOGI("rebuild KvStore snapshot failed, errCode %d.", static_cast(status)); + ZLOGI("rebuild KvStore snapshot failed, errCode status = %d.", static_cast(status)); // skip this failed, continue to do close kvstore process. } ZLOGI("close old KvStore."); dbStatus = oldDelegateMgr->CloseKvStore(kvStoreDelegate_); if (dbStatus != DistributedDB::DBStatus::OK) { - ZLOGI("rebuild KvStore failed during close KvStore, errCode %d.", static_cast(dbStatus)); + ZLOGI("rebuild KvStore failed during close KvStore, errCode status = %d.", static_cast(dbStatus)); newDelegateMgr->CloseKvStore(kvStoreDelegate); return Status::DB_ERROR; } @@ -581,14 +581,14 @@ Status KvStoreImpl::RebuildKvStoreObserver(DistributedDB::KvStoreDelegate *kvSto dbStatus = kvStoreDelegate_->UnRegisterObserver(observer); if (dbStatus != DistributedDB::OK) { status = Status::DB_ERROR; - ZLOGW("rebuild observer failed during UnRegisterObserver, status %d.", static_cast(dbStatus)); + ZLOGW("rebuild observer failed during UnRegisterObserver, status = %d.", static_cast(dbStatus)); continue; } dbStatus = kvStoreDelegate->RegisterObserver(observer); if (dbStatus != DistributedDB::OK) { status = Status::DB_ERROR; - ZLOGW("rebuild observer failed during RegisterObserver, status %d.", static_cast(dbStatus)); + ZLOGW("rebuild observer failed during RegisterObserver, status = %d.", static_cast(dbStatus)); continue; } } @@ -611,14 +611,14 @@ Status KvStoreImpl::RebuildKvStoreSnapshot(DistributedDB::KvStoreDelegate *kvSto Status status = snapshot->Release(kvStoreDelegate_); if (status != Status::SUCCESS) { retStatus = status; - ZLOGW("rebuild snapshot failed during release snapshot, errCode %d", static_cast(status)); + ZLOGW("rebuild snapshot failed during release snapshot, errCode = %d", static_cast(status)); continue; } status = snapshot->MigrateKvStore(kvStoreDelegate); if (status != Status::SUCCESS) { retStatus = status; - ZLOGW("rebuild snapshot failed during migrate snapshot, errCode %d", static_cast(status)); + ZLOGW("rebuild snapshot failed during migrate snapshot, errCode = %d", static_cast(status)); continue; } } @@ -671,15 +671,15 @@ Status KvStoreImpl::SubscribeKvStore(const SubscribeType subscribeType, sptrUnRegisterObserver(kvStoreObserverImpl); - ZLOGI("insert failed set size: %zu status: %d.", observerSet_.size(), static_cast(status)); + ZLOGI("insert failed set size = %zu status = %d.", observerSet_.size(), static_cast(status)); delete kvStoreObserverImpl; kvStoreObserverImpl = nullptr; return Status::STORE_ALREADY_SUBSCRIBE; } else { - ZLOGI("insert success set size: %zu.", observerSet_.size()); + ZLOGI("insert successful set size = %zu.", observerSet_.size()); } Reporter::GetInstance()->VisitStatistic()->Report({bundleName_, __FUNCTION__}); return Status::SUCCESS; @@ -711,7 +711,7 @@ Status KvStoreImpl::UnSubscribeKvStore(const SubscribeType subscribeType, sptr(dbStatus)); + ZLOGE("delegate return status = %d.", static_cast(dbStatus)); } else { - ZLOGW("No existing observer to unsubscribe. Return success."); + ZLOGW("No existing observer to unsubscribe. Return successful."); status = Status::SUCCESS; } delete kvStoreObserverImpl; kvStoreObserverImpl = nullptr; Reporter::GetInstance()->VisitStatistic()->Report({bundleName_, __FUNCTION__}); - ZLOGI("return status: %d", static_cast(status)); + ZLOGI("return status = %d", static_cast(status)); return status; } diff --git a/services/distributeddataservice/app/src/kvstore_meta_manager.cpp b/services/distributeddataservice/app/src/kvstore_meta_manager.cpp index 920c5cfb96591282dfc58c72501bf2307d792f2b..eb9410b386f24250da0e6380bb40e57fa9648c3e 100644 --- a/services/distributeddataservice/app/src/kvstore_meta_manager.cpp +++ b/services/distributeddataservice/app/src/kvstore_meta_manager.cpp @@ -66,7 +66,7 @@ KvStoreMetaManager::KvStoreMetaManager() } auto result = kvStoreDelegateManager_.CloseKvStore(delegate); if (result != DistributedDB::DBStatus::OK) { - ZLOGE("CloseMetaKvstore return error status: %d", static_cast(result)); + ZLOGE("CloseMetaKvstore return error status = %d", static_cast(result)); } }), metaDBDirectory_("/data/service/el1/public/database/distributeddata/meta"), @@ -99,7 +99,7 @@ void KvStoreMetaManager::InitMetaListener() ZLOGW("register failed."); return; } - ZLOGI("register meta device change success."); + ZLOGI("register meta device change successful."); SubscribeMetaKvStore(); } @@ -193,7 +193,7 @@ KvStoreMetaManager::NbDelegate KvStoreMetaManager::CreateMetaKvStore() }); if (dbStatusTmp != DistributedDB::DBStatus::OK) { - ZLOGE("GetKvStore return error status: %d", static_cast(dbStatusTmp)); + ZLOGE("GetKvStore return error status = %d", static_cast(dbStatusTmp)); return nullptr; } auto release = [this](DistributedDB::KvStoreNbDelegate *delegate) { @@ -204,7 +204,7 @@ KvStoreMetaManager::NbDelegate KvStoreMetaManager::CreateMetaKvStore() auto result = kvStoreDelegateManager_.CloseKvStore(delegate); if (result != DistributedDB::DBStatus::OK) { - ZLOGE("CloseMetaKvStore return error status: %d", static_cast(result)); + ZLOGE("CloseMetaKvStore return error status = %d", static_cast(result)); } }; return NbDelegate(kvStoreNbDelegatePtr, release); @@ -306,7 +306,7 @@ Status KvStoreMetaManager::CheckUpdateServiceMeta(const std::vector &me default: break; } - ZLOGI("Flag: %{public}d status: %{public}d", static_cast(flag), static_cast(dbStatus)); + ZLOGI("Flag = %{public}d status = %{public}d", static_cast(flag), static_cast(dbStatus)); SyncMeta(); return (dbStatus != DistributedDB::DBStatus::OK) ? Status::DB_ERROR : Status::SUCCESS; } @@ -318,7 +318,7 @@ Status KvStoreMetaManager::GenerateRootKey() struct HksParamSet *paramSet = nullptr; int32_t ret = HksInitParamSet(¶mSet); if (ret != HKS_SUCCESS) { - ZLOGE("HksInitParamSet() failed with error %{public}d", ret); + ZLOGE("HksInitParamSet() failed with error ret = %{public}d", ret); return Status::ERROR; } @@ -333,21 +333,21 @@ Status KvStoreMetaManager::GenerateRootKey() ret = HksAddParams(paramSet, genKeyParams, sizeof(genKeyParams) / sizeof(genKeyParams[0])); if (ret != HKS_SUCCESS) { - ZLOGE("HksAddParams failed with error %{public}d", ret); + ZLOGE("HksAddParams failed with error ret = %{public}d", ret); HksFreeParamSet(¶mSet); return Status::ERROR; } ret = HksBuildParamSet(¶mSet); if (ret != HKS_SUCCESS) { - ZLOGE("HksBuildParamSet failed with error %{public}d", ret); + ZLOGE("HksBuildParamSet failed with error ret = %{public}d", ret); HksFreeParamSet(¶mSet); return Status::ERROR; } ret = HksGenerateKey(&rootKeyName, paramSet, NULL); if (ret != HKS_SUCCESS) { - ZLOGE("HksGenerateKey failed with error %{public}d", ret); + ZLOGE("HksGenerateKey failed with error ret = %{public}d", ret); HksFreeParamSet(¶mSet); return Status::ERROR; } @@ -365,7 +365,7 @@ Status KvStoreMetaManager::GenerateRootKey() DistributedDB::DBStatus::OK) { return Status::ERROR; } - ZLOGI("GenerateRootKey Succeed."); + ZLOGI("GenerateRootKey Successful."); return Status::SUCCESS; } @@ -400,7 +400,7 @@ std::vector KvStoreMetaManager::EncryptWorkKey(const std::vector KvStoreMetaManager::EncryptWorkKey(const std::vector &encryptedKey struct HksParamSet *decryptParamSet = nullptr; int32_t ret = HksInitParamSet(&decryptParamSet); if (ret != HKS_SUCCESS) { - ZLOGE("HksInitParamSet() failed with error %{public}d", ret); + ZLOGE("HksInitParamSet() failed with error ret = %{public}d", ret); return false; } struct HksParam decryptParams[] = { @@ -465,21 +465,21 @@ bool KvStoreMetaManager::DecryptWorkKey(const std::vector &encryptedKey }; ret = HksAddParams(decryptParamSet, decryptParams, sizeof(decryptParams) / sizeof(decryptParams[0])); if (ret != HKS_SUCCESS) { - ZLOGE("HksAddParams failed with error %{public}d", ret); + ZLOGE("HksAddParams failed with error ret = %{public}d", ret); HksFreeParamSet(&decryptParamSet); return false; } ret = HksBuildParamSet(&decryptParamSet); if (ret != HKS_SUCCESS) { - ZLOGE("HksBuildParamSet failed with error %{public}d", ret); + ZLOGE("HksBuildParamSet failed with error ret = %{public}d", ret); HksFreeParamSet(&decryptParamSet); return false; } ret = HksDecrypt(&rootKeyName, decryptParamSet, &encryptedKeyBlob, &plainKeyBlob); if (ret != HKS_SUCCESS) { - ZLOGW("HksDecrypt failed with error %{public}d", ret); + ZLOGW("HksDecrypt failed with error ret = %{public}d", ret); HksFreeParamSet(&decryptParamSet); return false; } @@ -511,7 +511,7 @@ Status KvStoreMetaManager::WriteSecretKeyToMeta(const std::vector &meta DistributedDB::DBStatus dbStatus = metaDelegate->PutLocal(metaKey, secretKey); if (dbStatus != DistributedDB::DBStatus::OK) { - ZLOGE("end with %d", static_cast(dbStatus)); + ZLOGE("end with data = %d", static_cast(dbStatus)); return Status::DB_ERROR; } else { ZLOGD("normal end"); @@ -558,24 +558,24 @@ Status KvStoreMetaManager::RemoveSecretKey(pid_t uid, const std::string &bundleN DistributedDB::Key secretSingleDbKey = GetMetaKey(userId, "default", bundleName, storeId, "SINGLE_KEY"); DistributedDB::DBStatus dbStatus = metaDelegate->DeleteLocal(secretDbKey); if (dbStatus != DistributedDB::DBStatus::OK) { - ZLOGE("delete secretDbKey fail Status %d", static_cast(dbStatus)); + ZLOGE("delete secretDbKey failed Status = %d", static_cast(dbStatus)); status = Status::DB_ERROR; } dbStatus = metaDelegate->DeleteLocal(secretSingleDbKey); if (dbStatus != DistributedDB::DBStatus::OK) { - ZLOGE("delete secretSingleDbKey fail Status %d", static_cast(dbStatus)); + ZLOGE("delete secretSingleDbKey failed Status = %d", static_cast(dbStatus)); status = Status::DB_ERROR; } for (int32_t pathType = KvStoreAppManager::PATH_DE; pathType < KvStoreAppManager::PATH_TYPE_MAX; ++pathType) { std::string keyFile = GetSecretKeyFile(userId, bundleName, storeId, pathType); if (!RemoveFile(keyFile)) { - ZLOGW("remove secret key file %{public}s fail.", keyFile.c_str()); + ZLOGW("remove secret key file = %{public}s failed.", keyFile.c_str()); status = Status::DB_ERROR; } keyFile = GetSecretSingleKeyFile(userId, bundleName, storeId, pathType); if (!RemoveFile(keyFile)) { - ZLOGW("remove secretKeyFile Single fail."); + ZLOGW("remove secretKeyFile Single failed."); status = Status::DB_ERROR; } } @@ -820,7 +820,7 @@ void KvStoreMetaManager::SyncMeta() } if (devs.empty()) { - ZLOGW("meta db sync fail, devices is empty."); + ZLOGW("meta db sync failed, devices is empty."); return; } @@ -851,7 +851,7 @@ void KvStoreMetaManager::SubscribeMetaKvStore() int mode = DistributedDB::OBSERVER_CHANGES_NATIVE | DistributedDB::OBSERVER_CHANGES_FOREIGN; auto dbStatus = metaDelegate->RegisterObserver(DistributedDB::Key(), mode, &metaObserver_); if (dbStatus != DistributedDB::DBStatus::OK) { - ZLOGW("register meta observer failed :%{public}d.", dbStatus); + ZLOGW("register meta observer failed status = %{public}d.", dbStatus); } } @@ -892,7 +892,7 @@ Status KvStoreMetaManager::CheckSyncPermission(const std::string &userId, const GetStategyMeta(localKey, localStrategies); GetStategyMeta(remoteKey, remoteStrategies); if (localStrategies.empty() || remoteStrategies.empty()) { - ZLOGD("no range, sync permission success."); + ZLOGD("no range, sync permission successful."); return Status::SUCCESS; } @@ -903,19 +903,19 @@ Status KvStoreMetaManager::CheckSyncPermission(const std::string &userId, const for (auto const &lremote : lremotes) { std::vector rlocals = remoteSupportLocals->second; if (std::find(rlocals.begin(), rlocals.end(), lremote) != rlocals.end()) { - ZLOGD("find range, sync permission success."); + ZLOGD("find range, sync permission successful."); return Status::SUCCESS; } } } - ZLOGD("check strategy failed, sync permission fail."); + ZLOGD("check strategy failed, sync permission failed."); return Status::ERROR; } Status KvStoreMetaManager::GetStategyMeta(const std::string &key, std::map> &strategies) { - ZLOGD("get meta key:%s.", key.c_str()); + ZLOGD("get meta key = %s.", key.c_str()); auto &metaDelegate = GetMetaKvStore(); if (metaDelegate == nullptr) { ZLOGW("get delegate error."); @@ -925,7 +925,7 @@ Status KvStoreMetaManager::GetStategyMeta(const std::string &key, DistributedDB::Value values; auto dbStatus = metaDelegate->Get(DistributedDB::Key(key.begin(), key.end()), values); if (dbStatus != DistributedDB::DBStatus::OK) { - ZLOGW("get meta error %d.", dbStatus); + ZLOGW("get meta error = %d.", dbStatus); return Status::DB_ERROR; } @@ -986,7 +986,7 @@ void KvStoreMetaManager::KvStoreMetaObserver::HandleChanges( for (const auto &entry : entries) { std::string key(entry.key.begin(), entry.key.end()); for (const auto &item : handlerMap_) { - ZLOGI("flag:%{public}d, key:%{public}s", flag, key.c_str()); + ZLOGI("flag = %{public}d, key = %{public}s", flag, key.c_str()); if (key.find(item.first) == 0) { item.second(entry.key, entry.value, flag); } @@ -1029,7 +1029,7 @@ Status KvStoreMetaManager::QueryKvStoreMetaDataByDeviceIdAndAppId(const std::str if (status != DistributedDB::DBStatus::OK) { status = metaDelegate->GetEntries(DistributedDB::Key(prefix.begin(), prefix.end()), values); if (status != DistributedDB::DBStatus::OK) { - ZLOGW("query db failed key:%s, ret:%d.", dbPrefixKey.c_str(), static_cast(status)); + ZLOGW("query db failed key=%s, ret=%d.", dbPrefixKey.c_str(), static_cast(status)); return Status::ERROR; } } @@ -1039,12 +1039,12 @@ Status KvStoreMetaManager::QueryKvStoreMetaDataByDeviceIdAndAppId(const std::str json j = Serializable::ToJson(str); val.Unmarshal(j); if (val.appId == appId) { - ZLOGD("query meta success."); + ZLOGD("query meta successful."); return Status::SUCCESS; } } - ZLOGW("find meta failed id: %{public}s", appId.c_str()); + ZLOGW("find meta failed id = %{public}s", appId.c_str()); return Status::ERROR; } @@ -1058,7 +1058,7 @@ Status KvStoreMetaManager::GetKvStoreMeta(const std::vector &metaKey, K } DistributedDB::Value dbValue; DistributedDB::DBStatus dbStatus = metaDelegate->Get(metaKey, dbValue); - ZLOGI("status: %{public}d", static_cast(dbStatus)); + ZLOGI("status = %{public}d", static_cast(dbStatus)); if (dbStatus == DistributedDB::DBStatus::NOT_FOUND) { ZLOGI("key not found."); return Status::KEY_NOT_FOUND; @@ -1145,7 +1145,7 @@ T Serializable::GetVal(const json &j, const std::string &name, json::value_t typ if (it != j.end() && it->type() == type) { return *it; } - ZLOGW("not found name:%s.", name.c_str()); + ZLOGW("not found name = %s.", name.c_str()); return val; } @@ -1179,13 +1179,13 @@ bool KvStoreMetaManager::GetFullMetaData(std::map &entrie const std::string &metaKey = KvStoreMetaRow::KEY_PREFIX; DistributedDB::DBStatus dbStatus = metaDelegate->GetEntries({metaKey.begin(), metaKey.end()}, kvStoreMetaEntries); if (dbStatus != DistributedDB::DBStatus::OK) { - ZLOGE("Get kvstore meta data entries from metaDB failed, dbStatus: %d.", static_cast(dbStatus)); + ZLOGE("Get kvstore meta data entries from metaDB failed, dbStatus = %d.", static_cast(dbStatus)); return false; } for (auto const &kvStoreMeta : kvStoreMetaEntries) { std::string jsonStr(kvStoreMeta.value.begin(), kvStoreMeta.value.end()); - ZLOGD("kvStoreMetaData get json: %s", jsonStr.c_str()); + ZLOGD("kvStoreMetaData get json = %s", jsonStr.c_str()); auto metaObj = Serializable::ToJson(jsonStr); MetaData metaData {0}; metaData.kvStoreType = MetaData::GetKvStoreType(metaObj); @@ -1231,13 +1231,13 @@ bool KvStoreMetaManager::GetKvStoreMetaByType(const std::string &name, const std std::vector metaEntries; DistributedDB::DBStatus dbStatus = metaDelegate->GetEntries(metaKeyPrefix, metaEntries); if (dbStatus != DistributedDB::DBStatus::OK) { - ZLOGE("Get meta entries from metaDB failed, dbStatus: %d.", static_cast(dbStatus)); + ZLOGE("Get meta entries from metaDB failed, dbStatus = %d.", static_cast(dbStatus)); return false; } for (auto const &metaEntry : metaEntries) { std::string jsonStr(metaEntry.value.begin(), metaEntry.value.end()); - ZLOGD("KvStore get json: %s", jsonStr.c_str()); + ZLOGD("KvStore get json = %s", jsonStr.c_str()); json jsonObj = json::parse(jsonStr, nullptr, false); if (jsonObj.is_discarded()) { ZLOGE("parse json error"); diff --git a/services/distributeddataservice/app/src/kvstore_snapshot_impl.cpp b/services/distributeddataservice/app/src/kvstore_snapshot_impl.cpp index 783a0c0a063aec597e42423eb04ac12843bfba97..2ecace7b7d1f63bdf6366c28fdd61437c29e11f9 100644 --- a/services/distributeddataservice/app/src/kvstore_snapshot_impl.cpp +++ b/services/distributeddataservice/app/src/kvstore_snapshot_impl.cpp @@ -67,7 +67,7 @@ Status KvStoreSnapshotImpl::Get(const Key &key, Value &value) kvStoreSnapshotDelegate_->Get(dbKey, valueCallbackFunction); } if (retValueStatus != DistributedDB::DBStatus::OK) { - ZLOGE("delegate return error: %d.", static_cast(retValueStatus)); + ZLOGE("delegate return error = %d.", static_cast(retValueStatus)); if (retValueStatus == DistributedDB::DBStatus::NOT_FOUND) { return Status::KEY_NOT_FOUND; } @@ -154,7 +154,7 @@ void KvStoreSnapshotImpl::GetEntriesFromDelegateLocked(const Key &prefixKey, con // part2: entries to be returned this time. size of this part depends on ipc limit. // part3: entries that cannot be returned due to ipc limit. part3 should be buffered to batchEntries_. auto valueCallbackFunction = [&](DistributedDB::DBStatus status, const std::vector &entries) { - ZLOGD("delegate return entry size: %zu", entries.size()); + ZLOGD("delegate return entry size = %zu", entries.size()); retValueStatus = status; auto entry = entries.begin(); // deal with part1: skip already returned entries. @@ -209,11 +209,11 @@ void KvStoreSnapshotImpl::GetEntriesFromDelegateLocked(const Key &prefixKey, con return; } if (retValueStatus != DistributedDB::DBStatus::OK) { - ZLOGE("delegate return error: %d.", static_cast(retValueStatus)); + ZLOGE("delegate return error = %d.", static_cast(retValueStatus)); callback(Status::DB_ERROR, retEntries, nextStart); return; } - ZLOGD("retEntries size: %zu : %zu.", retEntries.size(), retSize); + ZLOGD("retEntries size = %zu retSize = %zu.", retEntries.size(), retSize); callback(Status::SUCCESS, retEntries, nextStart); } @@ -283,7 +283,7 @@ void KvStoreSnapshotImpl::GetKeysFromDelegateLocked(const Key &prefixKey, const size_t retSize = 0; Key nextStart; auto valueCallbackFunction = [&](DistributedDB::DBStatus status, const std::vector &entries) { - ZLOGD("delegate return entry size: %zu", entries.size()); + ZLOGD("delegate return entry size = %zu", entries.size()); retValueStatus = status; auto entry = entries.begin(); if (nextKey.Size() != 0) { @@ -322,11 +322,11 @@ void KvStoreSnapshotImpl::GetKeysFromDelegateLocked(const Key &prefixKey, const return; } if (retValueStatus != DistributedDB::DBStatus::OK) { - ZLOGE("delegate return error: %d.", static_cast(retValueStatus)); + ZLOGE("delegate return error = %d.", static_cast(retValueStatus)); callback(Status::DB_ERROR, retKeys, nextStart); return; } - ZLOGD("retKeys size: %zu : %zu.", retKeys.size(), retSize); + ZLOGD("retKeys size = %zu retSize = %zu.", retKeys.size(), retSize); callback(Status::SUCCESS, retKeys, nextStart); } @@ -340,7 +340,7 @@ Status KvStoreSnapshotImpl::Release(DistributedDB::KvStoreDelegate *kvStoreDeleg std::shared_lock lock(snapshotDelegateMutex_); DistributedDB::DBStatus status = kvStoreDelegate->ReleaseKvStoreSnapshot(kvStoreSnapshotDelegate_); if (status != DistributedDB::DBStatus::OK) { - ZLOGE("Error occurs during Releasing KvStoreSnapshot, error code %d.", status); + ZLOGE("Error occurs during Releasing KvStoreSnapshot, error code status = %d.", status); return Status::DB_ERROR; } kvStoreSnapshotDelegate_ = nullptr; @@ -363,7 +363,7 @@ Status KvStoreSnapshotImpl::MigrateKvStore(DistributedDB::KvStoreDelegate *kvSto std::unique_lock lock(snapshotDelegateMutex_); kvStoreDelegate->GetKvStoreSnapshot(kvStoreObserverImpl_, snapshotCallbackFunction); if (dbStatus != DistributedDB::DBStatus::OK || snapshotDelegate == nullptr) { - ZLOGE("delegate return nullptr or errcode, dbStatus:%d.", static_cast(dbStatus)); + ZLOGE("delegate return nullptr or errcode, dbStatus = %d.", static_cast(dbStatus)); return Status::DB_ERROR; } diff --git a/services/distributeddataservice/app/src/kvstore_sync_manager.cpp b/services/distributeddataservice/app/src/kvstore_sync_manager.cpp index 746477abef4a39ea16c029f046b1cc3d87fd0b08..7b8d53040bb756add560447b94c6fc2bfebbe35d 100644 --- a/services/distributeddataservice/app/src/kvstore_sync_manager.cpp +++ b/services/distributeddataservice/app/src/kvstore_sync_manager.cpp @@ -52,7 +52,7 @@ Status KvStoreSyncManager::AddSyncOperation(uintptr_t syncId, uint32_t delayMs, std::lock_guard lock(syncOpsMutex_); scheduleSyncOps_.emplace(beginTime, syncOp); - ZLOGD("add op %u delay %u count %zu.", opSeq, delayMs, scheduleSyncOps_.size()); + ZLOGD("add op = %u delay = %u count = %zu.", opSeq, delayMs, scheduleSyncOps_.size()); if ((scheduleSyncOps_.size() == 1) || (nextScheduleTime_ > beginTime + std::chrono::milliseconds(GetExpireTimeRange(delayMs)))) { AddTimer(beginTime); @@ -104,7 +104,7 @@ Status KvStoreSyncManager::RemoveSyncingOp(uint32_t opSeq, std::list bool { return opSeq == op.opSeq; }; - ZLOGD("remove op %u", opSeq); + ZLOGD("remove op = %u", opSeq); std::lock_guard lock(syncOpsMutex_); uint32_t count = DoRemoveSyncingOp(pred, syncingOps); return (count == 1) ? Status::SUCCESS : Status::ERROR; @@ -112,7 +112,7 @@ Status KvStoreSyncManager::RemoveSyncingOp(uint32_t opSeq, std::list &synci uint32_t count = DoRemoveSyncingOp(syncingTimeoutPred, syncingOps); if (count > 0) { - ZLOGI("remove %u syncing ops by timeout", count); + ZLOGI("remove count = %u syncing ops by timeout", count); } } void KvStoreSyncManager::Schedule(const TimePoint &time) { - ZLOGD("timeout %lld", time.time_since_epoch().count()); + ZLOGD("timeout count = %lld", time.time_since_epoch().count()); std::list syncOps; bool delaySchedule = GetTimeoutSyncOps(time, syncOps); diff --git a/services/distributeddataservice/app/src/kvstore_user_manager.cpp b/services/distributeddataservice/app/src/kvstore_user_manager.cpp index c4bc281c0d2cf11fde91590d4fd79165e17c4e8a..4b533a59f54d5795674eff93b9ceac7fc02185b4 100644 --- a/services/distributeddataservice/app/src/kvstore_user_manager.cpp +++ b/services/distributeddataservice/app/src/kvstore_user_manager.cpp @@ -111,7 +111,7 @@ Status KvStoreUserManager::MigrateAllKvStore(const std::string &harmonyAccountId for (auto &it : appMap_) { status = (it.second).MigrateAllKvStore(harmonyAccountId); if (status != Status::SUCCESS) { - ZLOGE("migrate all kvstore for app-%s failed, status:%d.", + ZLOGE("migrate all kvstore for app- = %s failed, status = %d.", it.first.c_str(), static_cast(status)); status = Status::MIGRATION_KVSTORE_FAILED; } diff --git a/services/distributeddataservice/app/src/query_helper.cpp b/services/distributeddataservice/app/src/query_helper.cpp index cb56bf8a5349bb24e346dcdc34442482d41760cd..c8a7661ff64242ef7372cc84093a6a88a6dffcc9 100644 --- a/services/distributeddataservice/app/src/query_helper.cpp +++ b/services/distributeddataservice/app/src/query_helper.cpp @@ -34,7 +34,7 @@ std::string QueryHelper::deviceId_{}; DistributedDB::Query QueryHelper::StringToDbQuery(const std::string &query, bool &isSuccess) { - ZLOGI("query string length:%{public}zu", query.length()); + ZLOGI("query string length=%{public}zu", query.length()); DistributedDB::Query dbQuery = DistributedDB::Query::Select(); if (query.size() == 0) { ZLOGI("Query string is empty."); @@ -548,9 +548,9 @@ void QueryHelper::HandleDeviceId(const std::vector &words, int &poi return; } deviceId_ = StringToString(words.at(pointer + 1)); // deviceId - ZLOGI("query devId string length:%zu", deviceId_.length()); + ZLOGI("query devId string length=%zu", deviceId_.length()); deviceId_ = KvStoreUtils::GetProviderInstance().GetUuidByNodeId(deviceId_); // convert to UUId - ZLOGI("query converted devId string length:%zu", deviceId_.length()); + ZLOGI("query converted devId string length=%zu", deviceId_.length()); if (!hasPrefixKey_) { ZLOGD("DeviceId as the only prefixKey."); const std::vector prefixVector(deviceId_.begin(), deviceId_.end()); diff --git a/services/distributeddataservice/app/src/security/security.cpp b/services/distributeddataservice/app/src/security/security.cpp index e2a9533ed53f9bfadc09bfee26662095b0965571..315afa6ab74514bdd3268a5825fde4d9228d592e 100644 --- a/services/distributeddataservice/app/src/security/security.cpp +++ b/services/distributeddataservice/app/src/security/security.cpp @@ -92,7 +92,7 @@ DBStatus Security::GetSecurityOption(const std::string &filePath, SecurityOption bool Security::CheckDeviceSecurityAbility(const std::string &deviceId, const SecurityOption &option) const { - ZLOGD("The kvstore security level: label:%d", option.securityLabel); + ZLOGD("The kvstore security level: label=%d", option.securityLabel); Sensitive sensitive = GetSensitiveByUuid(deviceId); return (sensitive >= option); } @@ -142,12 +142,12 @@ void Security::OnDeviceChanged(const AppDistributedKv::DeviceInfo &info, bool isOnline = type == AppDistributedKv::DeviceChangeType::DEVICE_ONLINE; if (isOnline) { Sensitive sensitive = GetSensitiveByUuid(info.deviceId); - ZLOGD("device is online, deviceId:%{public}s", Anonymous::Change(info.deviceId).c_str()); + ZLOGD("device is online, deviceId=%{public}s", Anonymous::Change(info.deviceId).c_str()); auto secuiryLevel = sensitive.GetDeviceSecurityLevel(); - ZLOGI("device is online, secuiry Level:%{public}d", secuiryLevel); + ZLOGI("device is online, secuiry Level=%{public}d", secuiryLevel); } else { EraseSensitiveByUuid(info.deviceId); - ZLOGD("device is offline, deviceId:%{public}s", Anonymous::Change(info.deviceId).c_str()); + ZLOGD("device is offline, deviceId=%{public}s", Anonymous::Change(info.deviceId).c_str()); } } @@ -170,7 +170,7 @@ Sensitive Security::GetSensitiveByUuid(const std::string &uuid) devices.push_back(network.GetLocalBasicInfo()); for (auto &device : devices) { auto deviceUuid = network.GetUuidByNodeId(device.deviceId); - ZLOGD("GetSensitiveByUuid(%{public}s) peer device is %{public}s", + ZLOGD("GetSensitiveByUuid=%{public}s peer device = %{public}s", Anonymous::Change(key).c_str(), Anonymous::Change(deviceUuid).c_str()); if (key != deviceUuid) { continue; @@ -202,7 +202,7 @@ int32_t Security::GetCurrentUserStatus() const DBStatus Security::SetFileSecurityOption(const std::string &filePath, const SecurityOption &option) { - ZLOGI("set security option %{public}d", option.securityLabel); + ZLOGI("set security option=%{public}d", option.securityLabel); if (!IsExits(filePath)) { return INVALID_ARGS; } @@ -211,14 +211,14 @@ DBStatus Security::SetFileSecurityOption(const std::string &filePath, const Secu } auto dataLevel = Convert2Name(option); if (dataLevel.empty()) { - ZLOGE("Invalid label args! label:%d, flag:%{public}d path:%{public}s", + ZLOGE("Invalid label args! label=%d, flag=%{public}d path=%{public}s", option.securityLabel, option.securityFlag, filePath.c_str()); return INVALID_ARGS; } bool result = OHOS::DistributedFS::ModuleSecurityLabel::SecurityLabel::SetSecurityLabel(filePath, dataLevel); if (!result) { - ZLOGE("set security label failed!, result:%d, datalevel:%{public}s", result, dataLevel.c_str()); + ZLOGE("set security label failed!, result=%d, datalevel=%{public}s", result, dataLevel.c_str()); return DBStatus::DB_ERROR; } @@ -243,7 +243,7 @@ DBStatus Security::GetFileSecurityOption(const std::string &filePath, SecurityOp option = {NOT_SET, ECE}; return OK; } - ZLOGI("get security option %{public}s", value.c_str()); + ZLOGI("get security option=%{public}s", value.c_str()); if (value == "s3") { option = { Convert2Security(value), SECE }; } else { diff --git a/services/distributeddataservice/app/src/security/sensitive.cpp b/services/distributeddataservice/app/src/security/sensitive.cpp index e035df4c2fed05d26862c3ef8e2f50f79301dbd9..2cc94346ded39ecee5057ecb06a04eab99d71954 100644 --- a/services/distributeddataservice/app/src/security/sensitive.cpp +++ b/services/distributeddataservice/app/src/security/sensitive.cpp @@ -45,7 +45,7 @@ uint32_t Sensitive::GetDeviceSecurityLevel() bool Sensitive::InitDEVSLQueryParams(DEVSLQueryParams *params, const std::string &udid) { - ZLOGI("udid is [%{public}s]", Anonymous::Change(udid).c_str()); + ZLOGI("udid = %{public}s", Anonymous::Change(udid).c_str()); if (params == nullptr || udid.empty()) { return false; } @@ -110,19 +110,19 @@ uint32_t Sensitive::GetSensitiveLevel(const std::string &udid) { DEVSLQueryParams query; if (!InitDEVSLQueryParams(&query, udid)) { - ZLOGE("init query params failed! udid:[%{public}s]", Anonymous::Change(udid).c_str()); + ZLOGE("init query params failed! udid=%{public}s", Anonymous::Change(udid).c_str()); return DATA_SEC_LEVEL1; } uint32_t level = DATA_SEC_LEVEL1; int32_t result = DATASL_GetHighestSecLevel(&query, &level); if (result != DEVSL_SUCCESS) { - ZLOGE("get highest level failed(%{public}s)! level: %{public}d, error: %d", + ZLOGE("get highest level failed(udid=%{public}s)! level=%{public}d, error=%d", Anonymous::Change(udid).c_str(), securityLevel, result); return DATA_SEC_LEVEL1; } securityLevel = level; - ZLOGI("get highest level success(%{public}s)! level: %{public}d, error: %d", + ZLOGI("get highest level successful(udid=%{public}s)! level=%{public}d, error=%d", Anonymous::Change(udid).c_str(), securityLevel, result); return securityLevel; } diff --git a/services/distributeddataservice/app/src/session_manager/session_manager.cpp b/services/distributeddataservice/app/src/session_manager/session_manager.cpp index cb17ec58f1266e11c05b83ab5aef60f4081acffb..a424d4e098b3d5495145ac049414e81b36c74b6c 100644 --- a/services/distributeddataservice/app/src/session_manager/session_manager.cpp +++ b/services/distributeddataservice/app/src/session_manager/session_manager.cpp @@ -52,7 +52,7 @@ Session SessionManager::GetSession(const SessionPoint &from, const std::string & for (const auto &user : users) { bool isPermitted = AuthDelegate::GetInstance()->CheckAccess(from.userId, user.id, targetDeviceId, from.appId); - ZLOGD("access to peer user %{public}d is %{public}d", user.id, isPermitted); + ZLOGD("access to peer user id=%{public}d isPermitted=%{public}d", user.id, isPermitted); if (isPermitted) { auto it = std::find(session.targetUserIds.begin(), session.targetUserIds.end(), user.id); if (it == session.targetUserIds.end()) { diff --git a/services/distributeddataservice/app/src/session_manager/upgrade_manager.cpp b/services/distributeddataservice/app/src/session_manager/upgrade_manager.cpp index e96a6a4aa20abc59b987d0df136ea15220c19a89..d25a3b60ce7d447a85efb3772deec9fa30ddb3d2 100644 --- a/services/distributeddataservice/app/src/session_manager/upgrade_manager.cpp +++ b/services/distributeddataservice/app/src/session_manager/upgrade_manager.cpp @@ -59,17 +59,17 @@ CapMetaData UpgradeManager::GetCapability(const std::string &deviceId, bool &sta return capMetaData; } auto dbKey = CapMetaRow::GetKeyFor(deviceId); - ZLOGD("cap key:%{public}s", std::string(dbKey.begin(), dbKey.end()).c_str()); + ZLOGD("cap key=%{public}s", std::string(dbKey.begin(), dbKey.end()).c_str()); DistributedDB::Value dbValue; auto ret = metaDelegate->Get(dbKey, dbValue); if (ret != DistributedDB::DBStatus::OK) { - ZLOGE("get cap meta failed, ret:%{public}d", ret); + ZLOGE("get cap meta failed, ret=%{public}d", ret); status = false; return capMetaData; } capMetaData.Unmarshall({ dbValue.begin(), dbValue.end() }); bool isOk = capabilityMap_.Insert(deviceId, capMetaData); - ZLOGI("device:%{public}.10s, version:%{public}d, insert:%{public}d", deviceId.c_str(), capMetaData.version, isOk); + ZLOGI("device=%{public}.10s, version=%{public}d, insert=%{public}d", deviceId.c_str(), capMetaData.version, isOk); return capMetaData; } @@ -87,7 +87,7 @@ bool UpgradeManager::InitLocalCapability() std::string jsonData = CapMetaData::Marshall(capMetaData); DistributedDB::Value dbValue { jsonData.begin(), jsonData.end() }; auto ret = metaDelegate->Put(dbKey, dbValue); - ZLOGI("put capability meta data ret %{public}d", ret); + ZLOGI("put capability meta data ret=%{public}d", ret); bool isOk = capabilityMap_.Insert(localDeviceId, capMetaData); return ret == DistributedDB::DBStatus::OK && isOk; } @@ -121,7 +121,7 @@ void UpgradeManager::SetCompatibleIdentifyByType(DistributedDB::KvStoreNbDelegat auto syncIdentifier = DistributedDB::KvStoreDelegateManager::GetKvStoreIdentifier(compatibleUser, tuple.appId, tuple.storeId); - ZLOGI("set compatible identifier, store:%{public}s, user:%{public}s, device:%{public}.10s", tuple.storeId.c_str(), + ZLOGI("set compatible identifier, store=%{public}s, user=%{public}s, device=%{public}.10s", tuple.storeId.c_str(), compatibleUser.c_str(), DistributedData::Serializable::Marshall(devices).c_str()); storeDelegate->SetEqualIdentifier(syncIdentifier, devices); } @@ -140,7 +140,7 @@ std::string UpgradeManager::GetIdentifierByType(int32_t groupType, bool &isSucce } return accountId; } else { - ZLOGW("not supported group type:%{public}d", groupType); + ZLOGW("not supported group type=%{public}d", groupType); isSuccess = false; return {}; } diff --git a/services/distributeddataservice/app/src/single_kvstore_impl.cpp b/services/distributeddataservice/app/src/single_kvstore_impl.cpp index 3fd7506153f690c87d1ca01f04db33e0b6300cf9..9ca842dd699d2ea0c5400cbd59afc0d9b6b5f5df 100644 --- a/services/distributeddataservice/app/src/single_kvstore_impl.cpp +++ b/services/distributeddataservice/app/src/single_kvstore_impl.cpp @@ -38,7 +38,7 @@ using namespace OHOS::DistributedData; static bool TaskIsBackground(pid_t pid) { std::ifstream ifs("/proc/" + std::to_string(pid) + "/cgroup", std::ios::in); - ZLOGD("pid %d open %d", pid, ifs.good()); + ZLOGD("pid = %d open = %d", pid, ifs.good()); if (!ifs.good()) { return false; } @@ -103,10 +103,10 @@ Status SingleKvStoreImpl::Put(const Key &key, const Value &value) status = kvStoreNbDelegate_->Put(tmpKey, tmpValue); } if (status == DistributedDB::DBStatus::OK) { - ZLOGD("succeed."); + ZLOGD("successful."); return Status::SUCCESS; } - ZLOGW("failed status: %d.", static_cast(status)); + ZLOGW("failed status = %d.", static_cast(status)); if (status == DistributedDB::DBStatus::INVALID_PASSWD_OR_CORRUPTED_DB) { ZLOGI("Put failed, distributeddb need recover."); @@ -179,10 +179,10 @@ Status SingleKvStoreImpl::Delete(const Key &key) status = kvStoreNbDelegate_->Delete(tmpKey); } if (status == DistributedDB::DBStatus::OK) { - ZLOGD("succeed."); + ZLOGD("successful."); return Status::SUCCESS; } - ZLOGW("failed status: %d.", static_cast(status)); + ZLOGW("failed status = %d.", static_cast(status)); if (status == DistributedDB::DBStatus::INVALID_PASSWD_OR_CORRUPTED_DB) { ZLOGI("Delete failed, distributeddb need recover."); return (Import(bundleName_) ? Status::RECOVER_SUCCESS : Status::RECOVER_FAILED); @@ -213,7 +213,7 @@ Status SingleKvStoreImpl::Get(const Key &key, Value &value) DdsTrace trace(std::string(LOG_TAG "Delegate::") + std::string(__FUNCTION__)); status = kvStoreNbDelegate_->Get(tmpKey, tmpValue); } - ZLOGD("status: %d.", static_cast(status)); + ZLOGD("status = %d.", static_cast(status)); if (status == DistributedDB::DBStatus::OK) { Reporter::GetInstance()->VisitStatistic()->Report({bundleName_, __FUNCTION__}); // Value don't have other write method. @@ -333,7 +333,7 @@ Status SingleKvStoreImpl::UnSubscribeKvStore(const SubscribeType subscribeType, IRemoteObject *objectPtr = observer->AsObject().GetRefPtr(); auto nbObserver = observerMap_.find(objectPtr); if (nbObserver == observerMap_.end()) { - ZLOGW("No existing observer to unsubscribe. Return success."); + ZLOGW("No existing observer to unsubscribe. Return successful."); return Status::SUCCESS; } DistributedDB::DBStatus dbStatus; @@ -383,10 +383,10 @@ Status SingleKvStoreImpl::GetEntries(const Key &prefixKey, std::vector &e DdsTrace trace(std::string(LOG_TAG "Delegate::") + std::string(__FUNCTION__)); status = kvStoreNbDelegate_->GetEntries(tmpKeyPrefix, dbEntries); } - ZLOGI("result DBStatus: %d", static_cast(status)); + ZLOGI("result DBStatus = %d", static_cast(status)); if (status == DistributedDB::DBStatus::OK) { entries.reserve(dbEntries.size()); - ZLOGD("vector size: %zu status: %d.", dbEntries.size(), static_cast(status)); + ZLOGD("vector size = %zu status = %d.", dbEntries.size(), static_cast(status)); for (auto const &dbEntry : dbEntries) { Key tmpKey(dbEntry.key); Value tmpValue(dbEntry.value); @@ -405,7 +405,7 @@ Status SingleKvStoreImpl::GetEntries(const Key &prefixKey, std::vector &e return Status::DB_ERROR; } if (status == DistributedDB::DBStatus::NOT_FOUND) { - ZLOGI("DB return NOT_FOUND, no matching result. Return success with empty list."); + ZLOGI("DB return NOT_FOUND, no matching result. Return successful with empty list."); return Status::SUCCESS; } if (status == DistributedDB::DBStatus::INVALID_ARGS) { @@ -432,7 +432,7 @@ Status SingleKvStoreImpl::GetEntriesWithQuery(const std::string &query, std::vec ZLOGE("StringToDbQuery failed."); return Status::INVALID_ARGUMENT; } else { - ZLOGD("StringToDbQuery success."); + ZLOGD("StringToDbQuery successful."); } std::shared_lock lock(storeNbDelegateMutex_); if (kvStoreNbDelegate_ == nullptr) { @@ -445,10 +445,10 @@ Status SingleKvStoreImpl::GetEntriesWithQuery(const std::string &query, std::vec DdsTrace trace(std::string(LOG_TAG "Delegate::") + std::string(__FUNCTION__)); status = kvStoreNbDelegate_->GetEntries(dbQuery, dbEntries); } - ZLOGI("result DBStatus: %d", static_cast(status)); + ZLOGI("result DBStatus = %d", static_cast(status)); if (status == DistributedDB::DBStatus::OK) { entries.reserve(dbEntries.size()); - ZLOGD("vector size: %zu status: %d.", dbEntries.size(), static_cast(status)); + ZLOGD("vector size = %zu status = %d.", dbEntries.size(), static_cast(status)); for (auto const &dbEntry : dbEntries) { Key tmpKey(dbEntry.key); Value tmpValue(dbEntry.value); @@ -460,7 +460,7 @@ Status SingleKvStoreImpl::GetEntriesWithQuery(const std::string &query, std::vec return Status::SUCCESS; } if (status == DistributedDB::DBStatus::NOT_FOUND) { - ZLOGI("DB return NOT_FOUND, no matching result. Return success with empty list."); + ZLOGI("DB return NOT_FOUND, no matching result. Return successful with empty list."); return Status::SUCCESS; } return ConvertDbStatus(status); @@ -494,7 +494,7 @@ void SingleKvStoreImpl::GetResultSet(const Key &prefixKey, DdsTrace trace(std::string(LOG_TAG "Delegate::") + std::string(__FUNCTION__)); status = kvStoreNbDelegate_->GetEntries(tmpKeyPrefix, dbResultSet); } - ZLOGI("result DBStatus: %d", static_cast(status)); + ZLOGI("result DBStatus = %d", static_cast(status)); if (status == DistributedDB::DBStatus::OK) { std::lock_guard lg(storeResultSetMutex_); sptr storeResultSet = CreateResultSet(dbResultSet, tmpKeyPrefix); @@ -525,7 +525,7 @@ void SingleKvStoreImpl::GetResultSetWithQuery(const std::string &query, ZLOGE("StringToDbQuery failed."); return; } else { - ZLOGD("StringToDbQuery success."); + ZLOGD("StringToDbQuery successful."); } std::shared_lock lock(storeNbDelegateMutex_); if (kvStoreNbDelegate_ == nullptr) { @@ -539,7 +539,7 @@ void SingleKvStoreImpl::GetResultSetWithQuery(const std::string &query, DdsTrace trace(std::string(LOG_TAG "Delegate::") + std::string(__FUNCTION__)); status = kvStoreNbDelegate_->GetEntries(dbQuery, dbResultSet); } - ZLOGI("result DBStatus: %d", static_cast(status)); + ZLOGI("result DBStatus = %d", static_cast(status)); if (status == DistributedDB::DBStatus::OK) { std::lock_guard lg(storeResultSetMutex_); sptr storeResultSet = CreateResultSet(dbResultSet, {}); @@ -600,7 +600,7 @@ Status SingleKvStoreImpl::GetCountWithQuery(const std::string &query, int &resul ZLOGE("StringToDbQuery failed."); return Status::INVALID_ARGUMENT; } else { - ZLOGD("StringToDbQuery success."); + ZLOGD("StringToDbQuery successful."); } std::shared_lock lock(storeNbDelegateMutex_); if (kvStoreNbDelegate_ == nullptr) { @@ -612,7 +612,7 @@ Status SingleKvStoreImpl::GetCountWithQuery(const std::string &query, int &resul DdsTrace trace(std::string(LOG_TAG "Delegate::") + std::string(__FUNCTION__)); status = kvStoreNbDelegate_->GetCount(dbQuery, result); } - ZLOGI("result DBStatus: %d", static_cast(status)); + ZLOGI("result DBStatus = %d", static_cast(status)); switch (status) { case DistributedDB::DBStatus::OK: { return Status::SUCCESS; @@ -634,7 +634,7 @@ Status SingleKvStoreImpl::GetCountWithQuery(const std::string &query, int &resul return Status::NOT_SUPPORT; } case DistributedDB::DBStatus::NOT_FOUND: { - ZLOGE("DB return NOT_FOUND, no matching result. Return success with count 0."); + ZLOGE("DB return NOT_FOUND, no matching result. Return successful with count 0."); result = 0; return Status::SUCCESS; } @@ -833,7 +833,7 @@ Status SingleKvStoreImpl::DoQuerySync(const std::vector &deviceIds, ZLOGE("StringToDbQuery failed."); return Status::INVALID_ARGUMENT; } - ZLOGD("StringToDbQuery success."); + ZLOGD("StringToDbQuery successful."); DistributedDB::DBStatus status; { std::shared_lock lock(storeNbDelegateMutex_); @@ -844,7 +844,7 @@ Status SingleKvStoreImpl::DoQuerySync(const std::vector &deviceIds, waitingSyncCount_--; DdsTrace trace(std::string(LOG_TAG "Delegate::") + std::string(__FUNCTION__)); status = kvStoreNbDelegate_->Sync(deviceUuids, dbMode, syncEnd, dbQuery, false); - ZLOGD("end: %d", static_cast(status)); + ZLOGD("end data = %d", static_cast(status)); } Reporter::GetInstance()->VisitStatistic()->Report({bundleName_, __FUNCTION__}); if (status == DistributedDB::DBStatus::BUSY) { @@ -879,7 +879,7 @@ Status SingleKvStoreImpl::DoSync(const std::vector &deviceIds, Sync waitingSyncCount_--; DdsTrace trace(std::string(LOG_TAG "Delegate::") + std::string(__FUNCTION__)); status = kvStoreNbDelegate_->Sync(deviceUuids, dbMode, syncEnd); - ZLOGD("end: %d", static_cast(status)); + ZLOGD("end data = %d", static_cast(status)); } Reporter::GetInstance()->VisitStatistic()->Report({bundleName_, __FUNCTION__}); if (status == DistributedDB::DBStatus::BUSY) { @@ -921,7 +921,7 @@ Status SingleKvStoreImpl::DoSubscribe(const std::vector &deviceIds, ZLOGE("StringToDbQuery failed."); return Status::INVALID_ARGUMENT; } - ZLOGD("StringToDbQuery success."); + ZLOGD("StringToDbQuery successful."); DistributedDB::DBStatus status; { std::shared_lock lock(storeNbDelegateMutex_); @@ -931,7 +931,7 @@ Status SingleKvStoreImpl::DoSubscribe(const std::vector &deviceIds, } DdsTrace trace(std::string(LOG_TAG "Delegate::") + std::string(__FUNCTION__)); status = kvStoreNbDelegate_->SubscribeRemoteQuery(deviceUuids, syncEnd, dbQuery, false); - ZLOGD("end: %d", static_cast(status)); + ZLOGD("end data = %d", static_cast(status)); } Reporter::GetInstance()->VisitStatistic()->Report({bundleName_, __FUNCTION__}); return ConvertDbStatus(status); @@ -952,7 +952,7 @@ Status SingleKvStoreImpl::DoUnSubscribe(const std::vector &deviceId ZLOGE("StringToDbQuery failed."); return Status::INVALID_ARGUMENT; } - ZLOGD("StringToDbQuery success."); + ZLOGD("StringToDbQuery successful."); DistributedDB::DBStatus status; { std::shared_lock lock(storeNbDelegateMutex_); @@ -962,7 +962,7 @@ Status SingleKvStoreImpl::DoUnSubscribe(const std::vector &deviceId } DdsTrace trace(std::string(LOG_TAG "Delegate::") + std::string(__FUNCTION__)); status = kvStoreNbDelegate_->UnSubscribeRemoteQuery(deviceUuids, syncEnd, dbQuery, false); - ZLOGD("end: %d", static_cast(status)); + ZLOGD("end data = %d", static_cast(status)); } return ConvertDbStatus(status); } @@ -1031,7 +1031,7 @@ Status SingleKvStoreImpl::ForceClose(DistributedDB::KvStoreDelegateManager *kvSt { DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); - ZLOGI("start, current openCount is %d.", openCount_); + ZLOGI("start, current openCount = %d.", openCount_); std::unique_lock lock(storeNbDelegateMutex_); if (kvStoreNbDelegate_ == nullptr || kvStoreDelegateManager == nullptr) { ZLOGW("get nullptr"); @@ -1046,7 +1046,7 @@ Status SingleKvStoreImpl::ForceClose(DistributedDB::KvStoreDelegateManager *kvSt delete observer->second; observer = observerMap_.erase(observer); } else { - ZLOGW("UnSubscribeKvStore failed during ForceClose, status %d.", dbStatus); + ZLOGW("UnSubscribeKvStore failed during ForceClose, status = %d.", dbStatus); return Status::ERROR; } } @@ -1055,7 +1055,7 @@ Status SingleKvStoreImpl::ForceClose(DistributedDB::KvStoreDelegateManager *kvSt for (auto resultSetPair = storeResultSetMap_.begin(); resultSetPair != storeResultSetMap_.end();) { Status status = (resultSetPair->second)->CloseResultSet(kvStoreNbDelegate_); if (status != Status::SUCCESS) { - ZLOGW("CloseResultSet failed during ForceClose, errCode %d", status); + ZLOGW("CloseResultSet failed during ForceClose, errCode status = %d", status); return status; } resultSetPair = storeResultSetMap_.erase(resultSetPair); @@ -1066,7 +1066,7 @@ Status SingleKvStoreImpl::ForceClose(DistributedDB::KvStoreDelegateManager *kvSt ZLOGI("end."); return Status::SUCCESS; } - ZLOGI("failed with error code %d.", status); + ZLOGI("failed with error code status = %d.", status); return Status::ERROR; } @@ -1127,7 +1127,7 @@ Status SingleKvStoreImpl::MigrateKvStore(const std::string &harmonyAccountId, dbStatus = status; }); if (kvStoreNbDelegate == nullptr) { - ZLOGE("storeDelegate is nullptr, dbStatusTmp: %d", static_cast(dbStatus)); + ZLOGE("storeDelegate is nullptr, dbStatusTmp = %d", static_cast(dbStatus)); return Status::DB_ERROR; } @@ -1136,26 +1136,26 @@ Status SingleKvStoreImpl::MigrateKvStore(const std::string &harmonyAccountId, auto data = static_cast(&autoSync); auto pragmaStatus = kvStoreNbDelegate->Pragma(DistributedDB::PragmaCmd::AUTO_SYNC, data); if (pragmaStatus != DistributedDB::DBStatus::OK) { - ZLOGE("pragmaStatus: %d", static_cast(pragmaStatus)); + ZLOGE("pragmaStatus = %d", static_cast(pragmaStatus)); } } status = RebuildKvStoreObserver(kvStoreNbDelegate); if (status != Status::SUCCESS) { - ZLOGI("rebuild KvStore observer failed, errCode %d.", static_cast(status)); + ZLOGI("rebuild KvStore observer failed, errCode = %d.", static_cast(status)); // skip this failed, continue to do other rebuild process. } status = RebuildKvStoreResultSet(); if (status != Status::SUCCESS) { - ZLOGI("rebuild KvStore resultset failed, errCode %d.", static_cast(status)); + ZLOGI("rebuild KvStore resultset failed, errCode = %d.", static_cast(status)); // skip this failed, continue to do close kvstore process. } ZLOGI("close old KvStore."); dbStatus = oldDelegateMgr->CloseKvStore(kvStoreNbDelegate_); if (dbStatus != DistributedDB::DBStatus::OK) { - ZLOGI("rebuild KvStore failed during close KvStore, errCode %d.", static_cast(status)); + ZLOGI("rebuild KvStore failed during close KvStore, errCode = %d.", static_cast(status)); newDelegateMgr->CloseKvStore(kvStoreNbDelegate); return Status::DB_ERROR; } @@ -1180,7 +1180,7 @@ Status SingleKvStoreImpl::RebuildKvStoreObserver(DistributedDB::KvStoreNbDelegat dbStatus = kvStoreNbDelegate_->UnRegisterObserver(observerPair.second); if (dbStatus != DistributedDB::OK) { status = Status::DB_ERROR; - ZLOGW("rebuild observer failed during UnRegisterObserver, status %d.", static_cast(dbStatus)); + ZLOGW("rebuild observer failed during UnRegisterObserver, status = %d.", static_cast(dbStatus)); continue; } dbStatus = kvStoreNbDelegate->RegisterObserver(emptyKey, @@ -1188,7 +1188,7 @@ Status SingleKvStoreImpl::RebuildKvStoreObserver(DistributedDB::KvStoreNbDelegat observerPair.second); if (dbStatus != DistributedDB::OK) { status = Status::DB_ERROR; - ZLOGW("rebuild observer failed during RegisterObserver, status %d.", static_cast(dbStatus)); + ZLOGW("rebuild observer failed during RegisterObserver, status = %d.", static_cast(dbStatus)); continue; } } @@ -1207,7 +1207,7 @@ Status SingleKvStoreImpl::RebuildKvStoreResultSet() Status status = (resultSetPair.second)->MigrateKvStore(kvStoreNbDelegate_); if (status != Status::SUCCESS) { retStatus = status; - ZLOGW("rebuild resultset failed, errCode %d", static_cast(status)); + ZLOGW("rebuild resultset failed, errCode = %d", static_cast(status)); continue; } } @@ -1458,7 +1458,7 @@ Status SingleKvStoreImpl::Control(KvControlCmd cmd, const KvParam &inputParam, s return Status::IPC_ERROR; } uint32_t allowedDelayMs = TransferByteArrayToType(inputParam.Data()); - ZLOGE("SET_SYNC_PARAM in %{public}d ms", allowedDelayMs); + ZLOGE("SET_SYNC_PARAM in allowMs = %{public}d ms", allowedDelayMs); if (allowedDelayMs > 0 && allowedDelayMs < KvStoreSyncManager::SYNC_MIN_DELAY_MS) { return Status::INVALID_ARGUMENT; } @@ -1466,12 +1466,12 @@ Status SingleKvStoreImpl::Control(KvControlCmd cmd, const KvParam &inputParam, s return Status::INVALID_ARGUMENT; } defaultSyncDelayMs_ = allowedDelayMs; - ZLOGE("SET_SYNC_PARAM save %{public}d ms", defaultSyncDelayMs_); + ZLOGE("SET_SYNC_PARAM save defaultMs = %{public}d ms", defaultSyncDelayMs_); return Status::SUCCESS; } case KvControlCmd::GET_SYNC_PARAM: { output = new KvParam(TransferTypeToByteArray(defaultSyncDelayMs_)); - ZLOGE("GET_SYNC_PARAM read %{public}d ms", defaultSyncDelayMs_); + ZLOGE("GET_SYNC_PARAM read defaultMs = %{public}d ms", defaultSyncDelayMs_); return Status::SUCCESS; } default: { @@ -1618,7 +1618,7 @@ void SingleKvStoreImpl::SetCompatibleIdentify(const std::string &changedDevice) bool flag = false; auto capability = UpgradeManager::GetInstance().GetCapability(changedDevice, flag); if (!flag || capability.version >= CapMetaData::CURRENT_VERSION) { - ZLOGE("get peer capability %{public}d, or not older version", flag); + ZLOGE("get peer capability flag=%{public}d, or not older version", flag); return; } @@ -1628,11 +1628,11 @@ void SingleKvStoreImpl::SetCompatibleIdentify(const std::string &changedDevice) flag = false; std::string compatibleUserId = UpgradeManager::GetIdentifierByType(groupType, flag); if (!flag) { - ZLOGE("failed to get identifier by group type %{public}d", groupType); + ZLOGE("failed to get identifier by group type=%{public}d", groupType); return; } // older version use bound account syncIdentifier instead of user syncIdentifier - ZLOGI("compatible user:%{public}s", compatibleUserId.c_str()); + ZLOGI("compatible user=%{public}s", compatibleUserId.c_str()); auto syncIdentifier = DistributedDB::KvStoreDelegateManager::GetKvStoreIdentifier(compatibleUserId, appId_, storeId_); kvStoreNbDelegate_->SetEqualIdentifier(syncIdentifier, { changedDevice }); diff --git a/services/distributeddataservice/app/src/uninstaller/uninstaller_impl.cpp b/services/distributeddataservice/app/src/uninstaller/uninstaller_impl.cpp index a12e49682ac6f8e7b7849bf3b88d4262c4f03b58..7b80d717b0c55a3450a7dbee9e80467bc330497d 100644 --- a/services/distributeddataservice/app/src/uninstaller/uninstaller_impl.cpp +++ b/services/distributeddataservice/app/src/uninstaller/uninstaller_impl.cpp @@ -63,7 +63,7 @@ void UninstallEventSubscriber::OnReceiveEvent(const CommonEventData &event) ElementName elementName = want.GetElement(); std::string bundleName = elementName.GetBundleName(); - ZLOGI("bundleName is %s", bundleName.c_str()); + ZLOGI("bundleName = %s", bundleName.c_str()); int userId = want.GetIntParam(USER_ID, -1); callback_(bundleName, userId); @@ -92,7 +92,7 @@ Status UninstallerImpl::Init(KvStoreDataService *kvStoreDataService) return; } if (!kvStoreMetaData.appId.empty() && !kvStoreMetaData.storeId.empty()) { - ZLOGI("Has been uninstalled bundleName:%s", bundleName.c_str()); + ZLOGI("Has been uninstalled bundleName=%s", bundleName.c_str()); AppId appId = {kvStoreMetaData.bundleName}; StoreId storeId = {kvStoreMetaData.storeId}; kvStoreDataService->DeleteKvStore(appId, storeId); @@ -108,16 +108,16 @@ Status UninstallerImpl::Init(KvStoreDataService *kvStoreDataService) while (tryTimes < MAX_RETRY_TIME) { auto result = CommonEventManager::SubscribeCommonEvent(subscriber_); if (result) { - ZLOGI("EventManager: Success"); + ZLOGI("EventManager: Successful"); break; } else { - ZLOGE("EventManager: Fail to Register Subscriber, error:%d", result); + ZLOGE("EventManager: Failed to Register Subscriber, error=%d", result); sleep(RETRY_WAIT_TIME_S); } tryTimes++; } if (MAX_RETRY_TIME == tryTimes) { - ZLOGE("EventManager: Fail to Register Subscriber!!!"); + ZLOGE("EventManager: Failed to Register Subscriber!!!"); } ZLOGI("Register listener End!!"); }); diff --git a/services/distributeddataservice/libs/distributeddb/test/unittest/common/common/distributeddb_auto_launch_test.cpp b/services/distributeddataservice/libs/distributeddb/test/unittest/common/common/distributeddb_auto_launch_test.cpp index 2a355eb7e6e355b59c1810a997c0383c4b5c3d6e..7dd8bda39abb75a9ab5e13ba00d771076d2f5a1a 100644 --- a/services/distributeddataservice/libs/distributeddb/test/unittest/common/common/distributeddb_auto_launch_test.cpp +++ b/services/distributeddataservice/libs/distributeddb/test/unittest/common/common/distributeddb_auto_launch_test.cpp @@ -175,7 +175,7 @@ static void PutSyncData(const KvDBProperties &prop, const Key &key, const Value TimeStamp time; kvStore->GetMaxTimeStamp(time); time += TIME_ADD; - LOGD("time:%lld", time); + LOGD("time=%lld", time); vect.push_back({key, value, time, 0, DBCommon::TransferHashString(REMOTE_DEVICE_ID)}); EXPECT_EQ(DistributedDBToolsUnitTest::PutSyncDataTest(kvStore, vect, REMOTE_DEVICE_ID), E_OK); } @@ -269,11 +269,11 @@ HWTEST_F(DistributedDBAutoLaunchUnitTest, AutoLaunch002, TestSize.Level3) auto notifier = [&cvMutex, &cv, &finished, &statusMap] (const std::string &userId, const std::string &appId, const std::string &storeId, AutoLaunchStatus status) { - LOGD("int AutoLaunch002 notifier status:%d", status); + LOGD("int AutoLaunch002 notifier status=%d", status); std::string identifier = DBCommon::TransferHashString(userId + "-" + appId + "-" + storeId); std::unique_lock lock(cvMutex); statusMap[identifier] = status; - LOGD("int AutoLaunch002 notifier statusMap.size():%d", statusMap.size()); + LOGD("int AutoLaunch002 notifier statusMap.size()=%d", statusMap.size()); if (statusMap.size() == 2) { // A and B finished = true; cv.notify_one(); @@ -346,11 +346,11 @@ HWTEST_F(DistributedDBAutoLaunchUnitTest, AutoLaunch003, TestSize.Level3) auto notifier = [&cvMutex, &cv, &finished, &statusMap] (const std::string &userId, const std::string &appId, const std::string &storeId, AutoLaunchStatus status) { - LOGD("int AutoLaunch002 notifier status:%d", status); + LOGD("int AutoLaunch002 notifier status=%d", status); std::string identifier = DBCommon::TransferHashString(userId + "-" + appId + "-" + storeId); std::unique_lock lock(cvMutex); statusMap[identifier] = status; - LOGD("int AutoLaunch002 notifier statusMap.size():%d", statusMap.size()); + LOGD("int AutoLaunch002 notifier statusMap.size()=%d", statusMap.size()); finished = true; cv.notify_one(); }; @@ -490,11 +490,11 @@ HWTEST_F(DistributedDBAutoLaunchUnitTest, AutoLaunch005, TestSize.Level3) auto notifier = [&cvMutex, &cv, &finished, &statusMap] (const std::string &userId, const std::string &appId, const std::string &storeId, AutoLaunchStatus status) { - LOGD("int AutoLaunch002 notifier status:%d", status); + LOGD("int AutoLaunch002 notifier status=%d", status); std::string identifier = DBCommon::TransferHashString(userId + "-" + appId + "-" + storeId); std::unique_lock lock(cvMutex); statusMap[identifier] = status; - LOGD("int AutoLaunch002 notifier statusMap.size():%d", statusMap.size()); + LOGD("int AutoLaunch002 notifier statusMap.size()=%d", statusMap.size()); finished = true; cv.notify_one(); }; @@ -557,7 +557,7 @@ HWTEST_F(DistributedDBAutoLaunchUnitTest, AutoLaunch006, TestSize.Level3) { auto notifier = [] (const std::string &userId, const std::string &appId, const std::string &storeId, AutoLaunchStatus status) { - LOGD("int AutoLaunch006 notifier status:%d", status); + LOGD("int AutoLaunch006 notifier status=%d", status); }; KvStoreObserverUnitTest *observer = new (std::nothrow) KvStoreObserverUnitTest; ASSERT_TRUE(observer != nullptr); @@ -573,7 +573,7 @@ HWTEST_F(DistributedDBAutoLaunchUnitTest, AutoLaunch006, TestSize.Level3) std::this_thread::sleep_for(std::chrono::milliseconds(WAIT_SHORT_TIME)); g_communicatorAggregator->RunCommunicatorLackCallback(label); std::this_thread::sleep_for(std::chrono::milliseconds(WAIT_SHORT_TIME)); - LOGD("AutoLaunch006 thread i:%d", i); + LOGD("AutoLaunch006 thread i=%d", i); } std::unique_lock lock(cvLock); threadIsWorking = false; @@ -593,7 +593,7 @@ HWTEST_F(DistributedDBAutoLaunchUnitTest, AutoLaunch006, TestSize.Level3) EXPECT_TRUE(errCode == E_OK); errCode = RuntimeContext::GetInstance()->DisableKvStoreAutoLaunch(g_identifierB, g_dualIdentifierB, USER_ID); EXPECT_TRUE(errCode == E_OK); - LOGD("AutoLaunch006 disable i:%d", i); + LOGD("AutoLaunch006 disable i=%d", i); } std::unique_lock lock(cvLock); cv.wait(lock, [&threadIsWorking] { return !threadIsWorking; }); @@ -626,7 +626,7 @@ void ConflictNotifierCallback(const KvStoreNbConflictData &data) void TestAutoLaunchNotifier(const std::string &userId, const std::string &appId, const std::string &storeId, AutoLaunchStatus status) { - LOGD("int AutoLaunchNotifier, status:%d", status); + LOGD("int AutoLaunchNotifier, status=%d", status); std::string identifier = DBCommon::TransferHashString(userId + "-" + appId + "-" + storeId); std::unique_lock lock(g_cvMutex); g_statusMap[identifier] = status; @@ -939,7 +939,7 @@ HWTEST_F(DistributedDBAutoLaunchUnitTest, AutoLaunch013, TestSize.Level3) { auto notifier = [] (const std::string &userId, const std::string &appId, const std::string &storeId, AutoLaunchStatus status) { - LOGD("int AutoLaunch013 notifier status:%d", status); + LOGD("int AutoLaunch013 notifier status=%d", status); }; /** * @tc.steps: step1. right param b c enable, a SetAutoLaunchRequestCallback diff --git a/services/distributeddataservice/libs/distributeddb/test/unittest/common/common/distributeddb_tools_unit_test.cpp b/services/distributeddataservice/libs/distributeddb/test/unittest/common/common/distributeddb_tools_unit_test.cpp index cb4d16398bf14aff6ad861a9e844a067e9bfa119..9562399f855d787a1a8f1543babf94a877d67c96 100644 --- a/services/distributeddataservice/libs/distributeddb/test/unittest/common/common/distributeddb_tools_unit_test.cpp +++ b/services/distributeddataservice/libs/distributeddb/test/unittest/common/common/distributeddb_tools_unit_test.cpp @@ -372,13 +372,13 @@ bool DistributedDBToolsUnitTest::IsEntryEqual(const DistributedDB::Entry &entryO const DistributedDB::Entry &entryRet) { if (entryOrg.key != entryRet.key) { - LOGD("key not equal, entryOrg key size is [%d], entryRet key size is [%d]", entryOrg.key.size(), + LOGD("key not equal, entryOrg key size = %d, entryRet key size = %d", entryOrg.key.size(), entryRet.key.size()); return false; } if (entryOrg.value != entryRet.value) { - LOGD("value not equal, entryOrg value size is [%d], entryRet value size is [%d]", entryOrg.value.size(), + LOGD("value not equal, entryOrg value size = %d, entryRet value size = %d", entryOrg.value.size(), entryRet.value.size()); return false; } @@ -405,11 +405,11 @@ bool DistributedDBToolsUnitTest::IsEntriesEqual(const std::vector &orgEntries, const std::list &resultLst) { - LOGD("orgEntries.size() is [%d], resultLst.size() is [%d]", orgEntries.size(), + LOGD("orgEntries.size() = %d, resultLst.size() = %d", orgEntries.size(), resultLst.size()); if (orgEntries.size() != resultLst.size()) { @@ -430,11 +430,11 @@ bool DistributedDBToolsUnitTest::CheckObserverResult(const std::vector(pos); if (fileSize < 1024) { // the least page size is 1024 bytes. - LOGE("Invalid database file:%llu.", fileSize); + LOGE("Invalid database file=%llu.", fileSize); return -E_UNEXPECTED_DATA; } } @@ -674,8 +674,9 @@ void KvStoreObserverUnitTest::OnChange(const KvStoreChangedData& data) updated_ = data.GetEntriesUpdated(); deleted_ = data.GetEntriesDeleted(); isCleared_ = data.IsCleared(); - LOGD("Onchangedata :%lu -- %lu -- %lu -- %d", inserted_.size(), updated_.size(), deleted_.size(), isCleared_); - LOGD("Onchange() called success!"); + LOGD("Onchangedata :in.size=%lu up.size=%lu de.size=%lu isCleared_=%d", + inserted_.size(), updated_.size(), deleted_.size(), isCleared_); + LOGD("Onchange() called successful!"); } void KvStoreObserverUnitTest::ResetToZero() @@ -726,8 +727,8 @@ void RelationalStoreObserverUnitTest::OnChange(const StoreChangedData& data) callCount_++; changeDevice_ = data.GetDataChangeDevice(); data.GetStoreProperty(storeProperty_); - LOGD("Onchangedata : %s", changeDevice_.c_str()); - LOGD("Onchange() called success!"); + LOGD("Onchangedata = %s", changeDevice_.c_str()); + LOGD("Onchange() called successful!"); } void RelationalStoreObserverUnitTest::ResetToZero() @@ -802,7 +803,7 @@ void KvStoreCorruptInfo::CorruptCallBack(const std::string &appId, const std::st databaseInfo.appId = appId; databaseInfo.userId = userId; databaseInfo.storeId = storeId; - LOGD("appId :%s, userId:%s, storeId:%s", appId.c_str(), userId.c_str(), storeId.c_str()); + LOGD("appId =%s, userId=%s, storeId=%s", appId.c_str(), userId.c_str(), storeId.c_str()); databaseInfoVect_.push_back(databaseInfo); } @@ -851,7 +852,7 @@ void DistributedDBToolsUnitTest::PrintTestCaseInfo() ASSERT_NE(test, nullptr); const testing::TestInfo *testInfo = test->current_test_info(); ASSERT_NE(testInfo, nullptr); - LOGI("Start unit test: %s.%s", testInfo->test_case_name(), testInfo->name()); + LOGI("Start unit test: name=%s. name=%s", testInfo->test_case_name(), testInfo->name()); } int DistributedDBToolsUnitTest::BuildMessage(const DataSyncMessageInfo &messageInfo, @@ -899,7 +900,7 @@ int RelationalTestUtils::ExecSql(sqlite3 *db, const std::string &sql) char *errMsg = nullptr; int errCode = sqlite3_exec(db, sql.c_str(), nullptr, nullptr, &errMsg); if (errCode != SQLITE_OK && errMsg != nullptr) { - LOGE("Execute sql failed. %d err: %s", errCode, errMsg); + LOGE("Execute sql failed. errCode=%d err=%s", errCode, errMsg); } sqlite3_free(errMsg); return errCode; diff --git a/services/distributeddataservice/libs/distributeddb/test/unittest/common/communicator/adapter_stub.cpp b/services/distributeddataservice/libs/distributeddb/test/unittest/common/communicator/adapter_stub.cpp index 92312b64b35e4b93c0c6478bfc26296640c33ca7..23ecc6f730bcafc78137ee65a9f7c82b80845286 100644 --- a/services/distributeddataservice/libs/distributeddb/test/unittest/common/communicator/adapter_stub.cpp +++ b/services/distributeddataservice/libs/distributeddb/test/unittest/common/communicator/adapter_stub.cpp @@ -79,17 +79,17 @@ int AdapterStub::SendBytes(const std::string &dstTarget, const uint8_t *bytes, u ApplySendBlock(); if (QuerySendRetry(dstTarget)) { - LOGI("[UT][Stub][Send] Retry for %s true.", dstTarget.c_str()); + LOGI("[UT][Stub][Send] Retry for dstTarget=%s true.", dstTarget.c_str()); return -E_WAIT_RETRY; } if (QuerySendTotalLoss()) { - LOGI("[UT][Stub][Send] Total loss for %s true.", dstTarget.c_str()); + LOGI("[UT][Stub][Send] Total loss for dstTarget=%s true.", dstTarget.c_str()); return E_OK; } if (QuerySendPartialLoss()) { - LOGI("[UT][Stub][Send] Partial loss for %s true.", dstTarget.c_str()); + LOGI("[UT][Stub][Send] Partial loss for dstTarget=%s true.", dstTarget.c_str()); return E_OK; } diff --git a/services/distributeddataservice/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_common.cpp b/services/distributeddataservice/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_common.cpp index 2fcd18b37fa700adc1054e8286629ca437fa6ef5..da1424f7812491188d421b05b271d3c582a80bf9 100644 --- a/services/distributeddataservice/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_common.cpp +++ b/services/distributeddataservice/libs/distributeddb/test/unittest/common/communicator/distributeddb_communicator_common.cpp @@ -26,25 +26,25 @@ using namespace DistributedDB; bool SetUpEnv(EnvHandle &inEnv, const string &inName) { if (inEnv.adapterHandle != nullptr || inEnv.commAggrHandle != nullptr) { - LOGI("[UT][Common][SetUp] Already Setup for %s", inName.c_str()); + LOGI("[UT][Common][SetUp] Already Setup for name=%s", inName.c_str()); return false; } inEnv.adapterHandle = new (nothrow) AdapterStub(inName); if (inEnv.adapterHandle == nullptr) { - LOGI("[UT][Common][SetUp] Create AdapterStub fail for %s", inName.c_str()); + LOGI("[UT][Common][SetUp] Create AdapterStub failed for name=%s", inName.c_str()); return false; } inEnv.commAggrHandle = new (nothrow) CommunicatorAggregator(); if (inEnv.commAggrHandle == nullptr) { - LOGI("[UT][Common][SetUp] Create CommunicatorAggregator fail for %s", inName.c_str()); + LOGI("[UT][Common][SetUp] Create CommunicatorAggregator failed for name=%s", inName.c_str()); return false; } int errCode = inEnv.commAggrHandle->Initialize(inEnv.adapterHandle); if (errCode != E_OK) { - LOGI("[UT][Common][SetUp] Init CommunicatorAggregator fail for %s", inName.c_str()); + LOGI("[UT][Common][SetUp] Init CommunicatorAggregator failed for name=%s", inName.c_str()); return false; } diff --git a/services/distributeddataservice/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_nb_transaction_test.cpp b/services/distributeddataservice/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_nb_transaction_test.cpp index 71ae88466c43691ef496618d330ff24ef91794c3..7e0633dc022b0a01b2e5e763842f6cb72f9ad0ca 100644 --- a/services/distributeddataservice/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_nb_transaction_test.cpp +++ b/services/distributeddataservice/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_nb_transaction_test.cpp @@ -109,11 +109,11 @@ namespace { Value newValue; data.GetKey(key); data.GetValue(OLD_VALUE_TYPE, oldValue); - LOGD("Get new value status:%d", data.GetValue(NEW_VALUE_TYPE, newValue)); + LOGD("Get new value status=%d", data.GetValue(NEW_VALUE_TYPE, newValue)); LOGD("Type:%d", data.GetType()); DBCommon::PrintHexVector(oldValue, __LINE__); DBCommon::PrintHexVector(newValue, __LINE__); - LOGD("Type:IsDeleted %d vs %d, IsNative %d vs %d", data.IsDeleted(OLD_VALUE_TYPE), + LOGD("Type:IsDeleted old=%d new=%d, IsNative old=%d new=%d", data.IsDeleted(OLD_VALUE_TYPE), data.IsDeleted(NEW_VALUE_TYPE), data.IsNative(OLD_VALUE_TYPE), data.IsNative(NEW_VALUE_TYPE)); g_conflictData.push_back({data.GetType(), key, oldValue, newValue, data.IsDeleted(OLD_VALUE_TYPE), data.IsDeleted(NEW_VALUE_TYPE), data.IsNative(OLD_VALUE_TYPE), data.IsNative(NEW_VALUE_TYPE), diff --git a/services/distributeddataservice/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_relational_test.cpp b/services/distributeddataservice/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_relational_test.cpp index 824f9be1d9fce6f5c31f348409089b23436ae899..715c520cf9d13756b14d23ae8970afa8d38104e8 100644 --- a/services/distributeddataservice/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_relational_test.cpp +++ b/services/distributeddataservice/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_relational_test.cpp @@ -747,7 +747,7 @@ HWTEST_F(DistributedDBInterfacesRelationalTest, RelationalOpenStorePressureTest0 std::thread openStoreThread([&, this]() { for (int i = 0; i < 1000; i++) { - LOGD("++++> open store delegate: %d", i); + LOGD("++++> open store delegate=%d", i); RelationalStoreDelegate *delegate = nullptr; DBStatus status = g_mgr.OpenStore(g_dbDir + STORE_ID + DB_SUFFIX, STORE_ID, {}, delegate); EXPECT_EQ(status, OK); @@ -756,7 +756,7 @@ HWTEST_F(DistributedDBInterfacesRelationalTest, RelationalOpenStorePressureTest0 std::lock_guard lock(queueLock); delegateQueue.push(delegate); } - LOGD("++++< open store delegate: %d", i); + LOGD("++++< open store delegate=%d", i); } }); @@ -772,9 +772,9 @@ HWTEST_F(DistributedDBInterfacesRelationalTest, RelationalOpenStorePressureTest0 delegate = delegateQueue.front(); delegateQueue.pop(); } - LOGD("++++> close store delegate: %d", cnt); + LOGD("++++> close store delegate=%d", cnt); DBStatus status = g_mgr.CloseStore(delegate); - LOGD("++++< close store delegate: %d", cnt); + LOGD("++++< close store delegate=%d", cnt); EXPECT_EQ(status, OK); delegate = nullptr; cnt++; diff --git a/services/distributeddataservice/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_resultset_performance.cpp b/services/distributeddataservice/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_resultset_performance.cpp index 0ded0a669fe1f7e81b1791467849509df56a4af3..e5f2fbe5ae0815bdf343257c967a5d8aaa7e42ac 100644 --- a/services/distributeddataservice/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_resultset_performance.cpp +++ b/services/distributeddataservice/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_resultset_performance.cpp @@ -148,7 +148,7 @@ HWTEST_F(DistributedDBInterfacesNBResultsetPerfTest, ResultSetPerfTest001, TestS LOGI("######## After get resultset"); int totalCount = readResultSet->GetCount(); EXPECT_EQ(totalCount, 50); // limit 50 - LOGI("######## After get count:%d", totalCount); + LOGI("######## After get count=%d", totalCount); readResultSet->MoveToPosition(0); LOGI("######## After move to next"); @@ -162,7 +162,7 @@ HWTEST_F(DistributedDBInterfacesNBResultsetPerfTest, ResultSetPerfTest001, TestS LOGI("######## After get resultset"); totalCount = readResultSet->GetCount(); EXPECT_EQ(totalCount, INSERT_NUMBER); - LOGI("######## After get count:%d", totalCount); + LOGI("######## After get count=%d", totalCount); readResultSet->MoveToPosition(offset); LOGI("######## After move to next"); diff --git a/services/distributeddataservice/libs/distributeddb/test/unittest/common/interfaces/process_system_api_adapter_impl.cpp b/services/distributeddataservice/libs/distributeddb/test/unittest/common/interfaces/process_system_api_adapter_impl.cpp index 821801545619d4db4f201a938fdea3bd0360fa57..96d391625b5e9135cf4fee38f961edaef3078937 100644 --- a/services/distributeddataservice/libs/distributeddb/test/unittest/common/interfaces/process_system_api_adapter_impl.cpp +++ b/services/distributeddataservice/libs/distributeddb/test/unittest/common/interfaces/process_system_api_adapter_impl.cpp @@ -62,7 +62,7 @@ DBStatus ProcessSystemApiAdapterImpl::SetSecurityOption(const std::string &fileP { bool isExisted = OS::CheckPathExistence(filePath); if (!isExisted) { - LOGE("SetSecurityOption to unexistence dir![%s]", filePath.c_str()); + LOGE("SetSecurityOption to unexistence dir! path = %s", filePath.c_str()); return NOT_FOUND; } @@ -70,7 +70,7 @@ DBStatus ProcessSystemApiAdapterImpl::SetSecurityOption(const std::string &fileP struct dirent *direntPtr = nullptr; DIR *dirPtr = opendir(filePath.c_str()); if (dirPtr == nullptr) { - LOGD("set path secOpt![%s] [%d] [%d]", filePath.c_str(), option.securityFlag, option.securityLabel); + LOGD("set path secOpt! path=%s flag=%d label=%d", filePath.c_str(), option.securityFlag, option.securityLabel); pathSecOptDic_[filePath] = option; return OK; } @@ -92,11 +92,13 @@ DBStatus ProcessSystemApiAdapterImpl::SetSecurityOption(const std::string &fileP SetSecurityOption(dirName, option); std::lock_guard lock(adapterlock_); pathSecOptDic_[dirName] = option; - LOGD("set path secOpt![%s] [%d] [%d]", dirName.c_str(), option.securityFlag, option.securityLabel); + LOGD("set path secOpt! path=%s flag=%d label=%d", + dirName.c_str(), option.securityFlag, option.securityLabel); } else { std::lock_guard lock(adapterlock_); pathSecOptDic_[dirName] = option; - LOGD("set path secOpt![%s] [%d] [%d]", dirName.c_str(), option.securityFlag, option.securityLabel); + LOGD("set path secOpt! path=%s flag=%d label=%d", + dirName.c_str(), option.securityFlag, option.securityLabel); continue; } } @@ -109,12 +111,13 @@ DBStatus ProcessSystemApiAdapterImpl::GetSecurityOption(const std::string &fileP { std::map temp = pathSecOptDic_; // For const interface only for test if (temp.find(filePath) == temp.end()) { - LOGE("[ProcessSystemApiAdapterImpl]::[GetSecurityOption] path [%s] not set secOpt!", filePath.c_str()); + LOGE("[ProcessSystemApiAdapterImpl]::[GetSecurityOption] path=%s not set secOpt!", filePath.c_str()); option.securityLabel = NOT_SET; option.securityFlag = 0; return OK; } - LOGD("[AdapterImpl] Get path secOpt![%s] [%d] [%d]", filePath.c_str(), option.securityFlag, option.securityLabel); + LOGD("[AdapterImpl] Get path secOpt! path=%s flag=%d label=%d", + filePath.c_str(), option.securityFlag, option.securityLabel); option = temp[filePath]; return OK; } diff --git a/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_relational_get_data_test.cpp b/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_relational_get_data_test.cpp index a80fca7468ffcbee617f120fb24ba0f07e1b5d35..29b2ebd613dafece3dd4f5c80ec0d4e3c26fff5d 100644 --- a/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_relational_get_data_test.cpp +++ b/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_relational_get_data_test.cpp @@ -64,7 +64,7 @@ void CreateDBAndTable() char *zErrMsg = nullptr; errCode = sqlite3_exec(db, sql.c_str(), nullptr, nullptr, &zErrMsg); if (errCode != SQLITE_OK) { - LOGE("sql error:%s", zErrMsg); + LOGE("sql error: msg=%s", zErrMsg); sqlite3_free(zErrMsg); } sqlite3_close(db); @@ -97,7 +97,7 @@ int GetLogData(int key, uint64_t &flag, TimeStamp ×tamp, const DeviceID &de sqlite3_stmt *statement = nullptr; int errCode = sqlite3_open(g_storePath.c_str(), &db); if (errCode != SQLITE_OK) { - LOGE("open db failed:%d", errCode); + LOGE("open db failed, errCode=%d", errCode); errCode = SQLiteUtils::MapSQLiteErrno(errCode); goto END; } @@ -267,7 +267,7 @@ void DistributedDBRelationalGetDataTest::SetUpTestCase(void) { DistributedDBToolsUnitTest::TestDirInit(g_testDir); g_storePath = g_testDir + "/getDataTest.db"; - LOGI("The test db is:%s", g_testDir.c_str()); + LOGI("The test db = %s", g_testDir.c_str()); } void DistributedDBRelationalGetDataTest::TearDownTestCase(void) diff --git a/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_sqlite_register_test.cpp b/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_sqlite_register_test.cpp index 6219f1edc31702f13be538998a03f5c1a1aa050b..337eb35f8b521fa1d7b07fb46ac020bf2f7200c6 100644 --- a/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_sqlite_register_test.cpp +++ b/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_sqlite_register_test.cpp @@ -54,7 +54,7 @@ namespace { int Callback(void *data, int argc, char **argv, char **azColName) { for (int i = 0; i < argc; i++) { - LOGI("%s = %s", azColName[i], argv[i] ? argv[i] : "NULL"); + LOGI("name=%s value=%s", azColName[i], argv[i] ? argv[i] : "NULL"); } return 0; } @@ -80,7 +80,7 @@ void DistributedDBSqliteRegisterTest::SetUpTestCase(void) errCode = sqlite3_exec(g_sqliteDb, SQL_CREATE_TABLE, nullptr, nullptr, &g_errMsg); if (errCode != SQLITE_OK) { if (g_errMsg != nullptr) { - LOGE("SQL error: %s\n", g_errMsg); + LOGE("SQL error: msg = %s\n", g_errMsg); sqlite3_free(g_errMsg); g_errMsg = nullptr; } @@ -131,7 +131,7 @@ HWTEST_F(DistributedDBSqliteRegisterTest, JsonExtract001, TestSize.Level1) int errCode = sqlite3_exec(g_sqliteDb, SQL_JSON_RIGHT, Callback, nullptr, &g_errMsg); if (errCode != SQLITE_OK) { if (g_errMsg != nullptr) { - LOGE("SQL error: %s\n", g_errMsg); + LOGE("SQL error: msg=%s\n", g_errMsg); sqlite3_free(g_errMsg); g_errMsg = nullptr; } @@ -156,7 +156,7 @@ HWTEST_F(DistributedDBSqliteRegisterTest, JsonExtract002, TestSize.Level1) int errCode = sqlite3_exec(g_sqliteDb, SQL_JSON_WRONG_PATH, Callback, nullptr, &g_errMsg); if (errCode != SQLITE_OK) { if (g_errMsg != nullptr) { - LOGE("SQL error: %s\n", g_errMsg); + LOGE("SQL error: msg=%s\n", g_errMsg); sqlite3_free(g_errMsg); g_errMsg = nullptr; } @@ -177,7 +177,7 @@ HWTEST_F(DistributedDBSqliteRegisterTest, JsonExtract003, TestSize.Level1) int errCode = sqlite3_exec(g_sqliteDb, SQL_JSON_WRONG_ARGS, Callback, nullptr, &g_errMsg); if (errCode != SQLITE_OK) { if (g_errMsg != nullptr) { - LOGE("SQL error: %s\n", g_errMsg); + LOGE("SQL error: msg=%s\n", g_errMsg); sqlite3_free(g_errMsg); g_errMsg = nullptr; } @@ -198,7 +198,7 @@ HWTEST_F(DistributedDBSqliteRegisterTest, CalcHashValue001, TestSize.Level1) int errCode = sqlite3_exec(g_sqliteDb, SQL_HASH, nullptr, nullptr, &g_errMsg); if (errCode != SQLITE_OK) { if (g_errMsg != nullptr) { - LOGE("SQL error: %s\n", g_errMsg); + LOGE("SQL error: msg=%s\n", g_errMsg); sqlite3_free(g_errMsg); g_errMsg = nullptr; } diff --git a/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_storage_encrypt_test.cpp b/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_storage_encrypt_test.cpp index 8b3a0b7e456a03b29f222ffeb1d125df63112095..5aacccc642ff0ba535217f516a55f882e6039ce8 100644 --- a/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_storage_encrypt_test.cpp +++ b/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_storage_encrypt_test.cpp @@ -91,7 +91,7 @@ namespace { char *zErrMsg = nullptr; int errCode = sqlite3_exec(g_db, CREATE_SQL.c_str(), nullptr, nullptr, &zErrMsg); if (errCode != SQLITE_OK && zErrMsg != nullptr) { - LOGE(" [SQLITE]: %s", zErrMsg); + LOGE(" [SQLITE] = %s", zErrMsg); sqlite3_free(zErrMsg); return errCode; } @@ -104,7 +104,7 @@ namespace { char *zErrMsg = nullptr; int errCode = sqlite3_key(g_db, static_cast(passwd), strlen(passwd)); if (errCode != SQLITE_OK && zErrMsg != nullptr) { - LOGE(" [SQLITE]: %s", zErrMsg); + LOGE(" [SQLITE] = %s", zErrMsg); sqlite3_free(zErrMsg); return errCode; } @@ -112,7 +112,7 @@ namespace { errCode = sqlite3_exec(g_db, (PRAGMA_KDF_ITER + to_string(iterNumber)).c_str(), nullptr, nullptr, &zErrMsg); if (errCode != SQLITE_OK && zErrMsg != nullptr) { - LOGE(" [SQLITE]: %s", zErrMsg); + LOGE(" [SQLITE] = %s", zErrMsg); sqlite3_free(zErrMsg); return errCode; } @@ -120,7 +120,7 @@ namespace { errCode = sqlite3_exec(g_db, (PRAGMA_CIPHER + algName + ";").c_str(), nullptr, nullptr, &zErrMsg); if (errCode != SQLITE_OK && zErrMsg != nullptr) { - LOGE(" [SQLITE]: %s", zErrMsg); + LOGE(" [SQLITE] = %s", zErrMsg); sqlite3_free(zErrMsg); return errCode; } @@ -194,7 +194,7 @@ namespace { int errCode = sqlite3_exec(g_db, ("INSERT OR REPLACE INTO data VALUES('" + keyStr + "','" + valueStr + "');").c_str(), nullptr, nullptr, &zErrMsg); if (errCode != SQLITE_OK && zErrMsg != nullptr) { - LOGE(" [SQLITE]: %s", zErrMsg); + LOGE(" [SQLITE] = %s", zErrMsg); sqlite3_free(zErrMsg); return errCode; } @@ -208,7 +208,7 @@ namespace { int errCode = sqlite3_exec(g_db, ("DELETE FROM data WHERE key='" + keyStr + "';").c_str(), nullptr, nullptr, &zErrMsg); if (errCode != SQLITE_OK && zErrMsg != nullptr) { - LOGE(" [SQLITE]: %s", zErrMsg); + LOGE(" [SQLITE] = %s", zErrMsg); sqlite3_free(zErrMsg); return errCode; } @@ -223,7 +223,7 @@ namespace { int errCode = sqlite3_exec(g_db, ("INSERT OR REPLACE INTO data VALUES('" + keyStr + "','" + valueStr + "');").c_str(), nullptr, nullptr, &zErrMsg); if (errCode != SQLITE_OK && zErrMsg != nullptr) { - LOGE(" [SQLITE]: %s", zErrMsg); + LOGE(" [SQLITE] = %s", zErrMsg); sqlite3_free(zErrMsg); return errCode; } @@ -237,7 +237,7 @@ namespace { int errCode = sqlite3_exec(g_db, ("SELECT value from data WHERE key='" + keyStr + "';").c_str(), Callback, static_cast(&value), &zErrMsg); if (errCode != SQLITE_OK && zErrMsg != nullptr) { - LOGE(" [SQLITE]: %s", zErrMsg); + LOGE(" [SQLITE] = %s", zErrMsg); sqlite3_free(zErrMsg); return errCode; } @@ -250,7 +250,7 @@ namespace { int errCode = sqlite3_exec(g_db, ("SELECT " + EXPORT_STRING + "('" + dbName + "');").c_str(), nullptr, nullptr, &zErrMsg); if (errCode != SQLITE_OK && zErrMsg != nullptr) { - LOGE(" [SQLITE]: %s", zErrMsg); + LOGE(" [SQLITE] = %s", zErrMsg); sqlite3_free(zErrMsg); return errCode; } @@ -263,7 +263,7 @@ namespace { int errCode = sqlite3_exec(g_db, ("attach '" + dbName + ".db' as " + dbName + " key '';").c_str(), nullptr, nullptr, &zErrMsg); if (errCode != SQLITE_OK && zErrMsg != nullptr) { - LOGE(" [SQLITE]: %s", zErrMsg); + LOGE(" [SQLITE] = %s", zErrMsg); sqlite3_free(zErrMsg); return errCode; } @@ -276,7 +276,7 @@ namespace { int errCode = sqlite3_exec(g_db, ("attach '" + dbName + ".db' as " + dbName + " key '" + passwd + "';").c_str(), nullptr, nullptr, &zErrMsg); if (errCode != SQLITE_OK && zErrMsg != nullptr) { - LOGE(" [SQLITE]: %s", zErrMsg); + LOGE(" [SQLITE] = %s", zErrMsg); sqlite3_free(zErrMsg); return errCode; } @@ -332,15 +332,15 @@ void DistributedDBStorageEncryptTest::SetUp(void) ASSERT_NE(test, nullptr); const testing::TestInfo *testInfo = test->current_test_info(); ASSERT_NE(testInfo, nullptr); - LOGI("Start unit test: %s.%s", testInfo->test_case_name(), testInfo->name()); + LOGI("Start unit test: name=%s. name=%s", testInfo->test_case_name(), testInfo->name()); /** * @tc.Clean DB files created from every test case. */ if (remove((STORE_ID + ".db").c_str()) != 0) { - LOGE("remove db failed, errno:%d", errno); + LOGE("remove db failed, errno=%d", errno); } if (remove((STORE_ID2 + ".db").c_str()) != 0) { - LOGE("remove db failed, errno:%d", errno); + LOGE("remove db failed, errno=%d", errno); } } @@ -356,10 +356,10 @@ void DistributedDBStorageEncryptTest::TearDown(void) * @tc.Clean DB files created from every test case. */ if (remove((STORE_ID + ".db").c_str()) != 0) { - LOGE("remove db failed, errno:%d", errno); + LOGE("remove db failed, errno=%d", errno); } if (remove((STORE_ID2 + ".db").c_str()) != 0) { - LOGE("remove db failed, errno:%d", errno); + LOGE("remove db failed, errno=%d", errno); } /** * @tc.Wait a number of SLEEP_TIME until remove done. diff --git a/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_storage_memory_single_ver_naturall_store_test.cpp b/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_storage_memory_single_ver_naturall_store_test.cpp index 132e387aee1b2eeaa1363289c7acb854273fdccf..79a8493a414b8db6a7c429606ebd309decfe3e0a 100644 --- a/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_storage_memory_single_ver_naturall_store_test.cpp +++ b/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_storage_memory_single_ver_naturall_store_test.cpp @@ -42,7 +42,7 @@ public: void DistributedDBStorageMemorySingleVerNaturalStoreTest::SetUpTestCase(void) { DistributedDBToolsUnitTest::TestDirInit(g_testDir); - LOGD("Test dir is %s", g_testDir.c_str()); + LOGD("Test dir =s %s", g_testDir.c_str()); DistributedDBToolsUnitTest::RemoveTestDbFiles(g_testDir + "/TestGeneralNB/" + DBConstant::SINGLE_SUB_DIR); } diff --git a/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_storage_register_conflict_test.cpp b/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_storage_register_conflict_test.cpp index 31a3c0008962e905e332c25c0cd8e6e929b1b017..5a633877e7a58a5fabd6c6bb57256075d63fdbc6 100644 --- a/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_storage_register_conflict_test.cpp +++ b/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_storage_register_conflict_test.cpp @@ -115,11 +115,11 @@ namespace { Value newValue; data.GetKey(key); data.GetValue(OLD_VALUE_TYPE, oldValue); - LOGD("Get new value status:%d", data.GetValue(NEW_VALUE_TYPE, newValue)); - LOGD("Type:%d", data.GetType()); + LOGD("Get new value status=%d", data.GetValue(NEW_VALUE_TYPE, newValue)); + LOGD("Type=%d", data.GetType()); DBCommon::PrintHexVector(oldValue, __LINE__); DBCommon::PrintHexVector(newValue, __LINE__); - LOGD("Type:IsDeleted %d vs %d, IsNative %d vs %d", data.IsDeleted(OLD_VALUE_TYPE), + LOGD("Type:old=%d vs new=%d, IsNative old=%d vs new=%d", data.IsDeleted(OLD_VALUE_TYPE), data.IsDeleted(NEW_VALUE_TYPE), data.IsNative(OLD_VALUE_TYPE), data.IsNative(NEW_VALUE_TYPE)); g_conflictData.push_back({data.GetType(), key, oldValue, newValue, data.IsDeleted(OLD_VALUE_TYPE), data.IsDeleted(NEW_VALUE_TYPE), data.IsNative(OLD_VALUE_TYPE), data.IsNative(NEW_VALUE_TYPE), @@ -222,12 +222,12 @@ static bool CheckNewConflictData(KvDBConflictEntry ¬ifyData, KvDBConflictEntr } if (notifyData.oldData.isDeleted != expectNotifyData.oldData.isDeleted) { - LOGD("Old Data IsDeleted ERROR! Actual %d vs Expected %d", notifyData.oldData.isDeleted, + LOGD("Old Data IsDeleted ERROR! Actual=%d vs Expected=%d", notifyData.oldData.isDeleted, expectNotifyData.oldData.isDeleted); return false; } if (notifyData.oldData.isLocal != expectNotifyData.oldData.isLocal) { - LOGD("Old Data IsLocal ERROR! Actual %d vs Expected %d", + LOGD("Old Data IsLocal ERROR! Actual=%d vs Expected=%d", notifyData.oldData.isLocal, expectNotifyData.oldData.isLocal); return false; } @@ -245,7 +245,7 @@ static bool CheckNewConflictData(KvDBConflictEntry ¬ifyData, KvDBConflictEntr static bool CheckOldConflictData(KvDBConflictEntry ¬ifyData, KvDBConflictEntry &expectNotifyData) { if (notifyData.type != expectNotifyData.type) { - LOGD("Conflict Type ERROR! Actual %d vs Expected %d", notifyData.type, expectNotifyData.type); + LOGD("Conflict Type ERROR! Actual=%d vs Expected=%d", notifyData.type, expectNotifyData.type); return false; } @@ -255,13 +255,13 @@ static bool CheckOldConflictData(KvDBConflictEntry ¬ifyData, KvDBConflictEntr } if (notifyData.newData.isDeleted != expectNotifyData.newData.isDeleted) { - LOGD("New Data IsDeleted ERROR! Actual %d vs Expected %d", notifyData.newData.isDeleted, + LOGD("New Data IsDeleted ERROR! Actual=%d vs Expected=%d", notifyData.newData.isDeleted, expectNotifyData.newData.isDeleted); return false; } if (notifyData.newData.isLocal != expectNotifyData.newData.isLocal) { - LOGD("New Data IsLocal ERROR! Actual %d vs Expected %d", notifyData.newData.isLocal, + LOGD("New Data IsLocal ERROR! Actual=%d vs Expected=%d", notifyData.newData.isLocal, expectNotifyData.newData.isLocal); return false; } diff --git a/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_storage_register_observer_test.cpp b/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_storage_register_observer_test.cpp index 614a9751c5152f5e3bacce17eb1fd53b75b1a947..171b7e4af469fe9d8c22f15643516688f08d7b25 100644 --- a/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_storage_register_observer_test.cpp +++ b/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_storage_register_observer_test.cpp @@ -91,7 +91,7 @@ namespace { ASSERT_EQ(errCode, E_OK); g_deletedEntries = data.GetDeletedEntries(errCode); ASSERT_EQ(errCode, E_OK); - LOGI("Insert:%zu, update:%zu, delete:%zu", g_insertedEntries.size(), g_updatedEntries.size(), + LOGI("Insert=%zu, update=%zu, delete=%zu", g_insertedEntries.size(), g_updatedEntries.size(), g_deletedEntries.size()); return; } diff --git a/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_storage_sqlite_single_ver_natural_store_test.cpp b/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_storage_sqlite_single_ver_natural_store_test.cpp index f941f0ef4b1688c9b257ae33e1688a613f4c781b..deb88fdb096d75adaf1b525f7b9af47fa95e3fe0 100644 --- a/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_storage_sqlite_single_ver_natural_store_test.cpp +++ b/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_storage_sqlite_single_ver_natural_store_test.cpp @@ -52,7 +52,7 @@ void DistributedDBStorageSQLiteSingleVerNaturalStoreTest::SetUp(void) { DistributedDBToolsUnitTest::PrintTestCaseInfo(); DistributedDBToolsUnitTest::TestDirInit(g_testDir); - LOGD("DistributedDBStorageSQLiteSingleVerNaturalStoreTest dir is %s", g_testDir.c_str()); + LOGD("DistributedDBStorageSQLiteSingleVerNaturalStoreTest dir = %s", g_testDir.c_str()); std::string oriIdentifier = APP_ID + "-" + USER_ID + "-" + "TestGeneralNB"; std::string identifier = DBCommon::TransferHashString(oriIdentifier); std::string g_identifier = DBCommon::TransferStringToHex(identifier); diff --git a/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_storage_subscribe_query_test.cpp b/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_storage_subscribe_query_test.cpp index c44b497b6cee385ed63e5bf7fedd7ed40c18f322..c3a007cdad8ee4e10f5b069de463de0f77bc0e00 100644 --- a/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_storage_subscribe_query_test.cpp +++ b/services/distributeddataservice/libs/distributeddb/test/unittest/common/storage/distributeddb_storage_subscribe_query_test.cpp @@ -139,7 +139,7 @@ std::string FbfFileToSchemaString(const std::string &fileName) std::string filePath = g_resourceDir + "fbs_files_for_ut/" + fileName; std::ifstream is(filePath, std::ios::binary | std::ios::ate); if (!is.is_open()) { - LOGE("[FbfFileToSchemaString] open file failed name : %s", filePath.c_str()); + LOGE("[FbfFileToSchemaString] open file failed name = %s", filePath.c_str()); return ""; } @@ -150,7 +150,7 @@ std::string FbfFileToSchemaString(const std::string &fileName) if (is.read(&schema[0], size)) { return schema; } - LOGE("[FbfFileToSchemaString] read file failed path : %s", filePath.c_str()); + LOGE("[FbfFileToSchemaString] read file failed path = %s", filePath.c_str()); return ""; } #endif