mirror of
https://gitee.com/openharmony/ability_dmsfwk
synced 2024-11-23 06:20:07 +00:00
优化日志打印
Signed-off-by: m30043719 <maxiaodong25@huawei.com>
This commit is contained in:
parent
9b3083c328
commit
aa051ae971
@ -644,7 +644,7 @@ void DistributedSchedService::OnDeviceOnlineEx(const OHOS::DistributedHardware::
|
||||
std::lock_guard<std::mutex> autoLock(dmsAdapetrLock_);
|
||||
if (dllHandle_ == nullptr) {
|
||||
HILOGE("Open dms interactive adapter shared object failed");
|
||||
return NOT_FIND_SERVICE_REGISTRY;
|
||||
return;
|
||||
}
|
||||
if (dmsAdapetr_.OnDeviceOnlineEx == nullptr) {
|
||||
HILOGE("Dms interactive on device online extention handle is null.");
|
||||
@ -659,7 +659,7 @@ void DistributedSchedService::OnDeviceOfflineEx(const OHOS::DistributedHardware:
|
||||
std::lock_guard<std::mutex> autoLock(dmsAdapetrLock_);
|
||||
if (dllHandle_ == nullptr) {
|
||||
HILOGE("Open dms interactive adapter shared object failed");
|
||||
return NOT_FIND_SERVICE_REGISTRY;
|
||||
return;
|
||||
}
|
||||
if (dmsAdapetr_.OnDeviceOfflineEx == nullptr) {
|
||||
HILOGE("Dms interactive on device online extention handle is null.");
|
||||
@ -674,7 +674,7 @@ void DistributedSchedService::OnDeviceInfoChangedEx(const OHOS::DistributedHardw
|
||||
std::lock_guard<std::mutex> autoLock(dmsAdapetrLock_);
|
||||
if (dllHandle_ == nullptr) {
|
||||
HILOGE("Open dms interactive adapter shared object failed");
|
||||
return NOT_FIND_SERVICE_REGISTRY;
|
||||
return;
|
||||
}
|
||||
if (dmsAdapetr_.OnDeviceInfoChangedEx == nullptr) {
|
||||
HILOGE("Dms interactive on device online extention handle is null.");
|
||||
|
@ -256,16 +256,16 @@ bool DmsBmStorage::GetStorageDistributeInfo(const std::string &networkId,
|
||||
int64_t begin = GetTickCount();
|
||||
kvStorePtr_->Get(key, networkId,
|
||||
[&value, &resultStatusSignal](Status innerStatus, Value innerValue) {
|
||||
HILOGI("The get, result = %{public}d", innerStatus);
|
||||
HILOGD("The get, result = %{public}d", innerStatus);
|
||||
if (innerStatus == Status::SUCCESS) {
|
||||
value = innerValue;
|
||||
}
|
||||
resultStatusSignal.set_value(innerStatus);
|
||||
});
|
||||
Status status = GetResultSatus(resultStatusSignal);
|
||||
HILOGI("GetEntries spend %{public}" PRId64 " ms", GetTickCount() - begin);
|
||||
HILOGD("GetEntries spend %{public}" PRId64 " ms", GetTickCount() - begin);
|
||||
if (status == Status::SUCCESS) {
|
||||
HILOGI("Get result = ok");
|
||||
HILOGD("Get result = ok");
|
||||
info.FromJsonString(value.ToString());
|
||||
return true;
|
||||
}
|
||||
@ -276,7 +276,7 @@ bool DmsBmStorage::GetStorageDistributeInfo(const std::string &networkId,
|
||||
bool DmsBmStorage::DealGetBundleName(const std::string &networkId, const uint16_t& bundleNameId,
|
||||
std::string &bundleName)
|
||||
{
|
||||
HILOGI("networkId: %{public}s bundleNameId: %{public}d", GetAnonymStr(networkId).c_str(), bundleNameId);
|
||||
HILOGD("networkId: %{public}s bundleNameId: %{public}d", GetAnonymStr(networkId).c_str(), bundleNameId);
|
||||
if (!CheckKvStore()) {
|
||||
HILOGE("kvStore is nullptr");
|
||||
return false;
|
||||
@ -365,7 +365,7 @@ bool DmsBmStorage::DelReduData(const std::string &networkId, const std::vector<D
|
||||
|
||||
bool DmsBmStorage::CheckSyncData(const std::string &networkId)
|
||||
{
|
||||
HILOGI("called");
|
||||
HILOGD("called");
|
||||
std::string uuid = DtbschedmgrDeviceInfoStorage::GetInstance().GetUuidByNetworkId(networkId);
|
||||
if (uuid == "") {
|
||||
HILOGE("can not get udid or uuid by networkId");
|
||||
@ -388,7 +388,7 @@ bool DmsBmStorage::CheckSyncData(const std::string &networkId)
|
||||
bool DmsBmStorage::GetDistributedBundleName(const std::string &networkId, const uint16_t& bundleNameId,
|
||||
std::string &bundleName)
|
||||
{
|
||||
HILOGI("networkId: %{public}s bundleNameId: %{public}d", GetAnonymStr(networkId).c_str(), bundleNameId);
|
||||
HILOGD("networkId: %{public}s bundleNameId: %{public}d", GetAnonymStr(networkId).c_str(), bundleNameId);
|
||||
if (!CheckSyncData(networkId)) {
|
||||
HILOGE("CheckSyncData fail");
|
||||
return false;
|
||||
@ -398,14 +398,14 @@ bool DmsBmStorage::GetDistributedBundleName(const std::string &networkId, const
|
||||
HILOGE("get bundleName failed: %{public}d", ret);
|
||||
return false;
|
||||
}
|
||||
HILOGI("end.");
|
||||
HILOGD("end.");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DmsBmStorage::GetDistributedBundleInfo(const std::string &networkId,
|
||||
const uint16_t &bundleNameId, DmsBundleInfo &distributeBundleInfo)
|
||||
{
|
||||
HILOGI("networkId: %{public}s bundleNameId: %{public}d", GetAnonymStr(networkId).c_str(), bundleNameId);
|
||||
HILOGD("networkId: %{public}s bundleNameId: %{public}d", GetAnonymStr(networkId).c_str(), bundleNameId);
|
||||
if (!CheckKvStore()) {
|
||||
HILOGE("kvStore is nullptr");
|
||||
return false;
|
||||
@ -449,7 +449,7 @@ bool DmsBmStorage::GetDistributedBundleInfo(const std::string &networkId,
|
||||
HILOGE("get distributedBundleInfo failed.");
|
||||
return false;
|
||||
}
|
||||
HILOGI("end.");
|
||||
HILOGD("end.");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -466,20 +466,20 @@ Status DmsBmStorage::GetResultSatus(std::promise<OHOS::DistributedKv::Status> &r
|
||||
void DmsBmStorage::GetEntries(const std::string &networkId, const Key &allEntryKeyPrefix,
|
||||
std::promise<OHOS::DistributedKv::Status> &resultStatusSignal, std::vector<Entry> &allEntries)
|
||||
{
|
||||
HILOGI("called.");
|
||||
HILOGD("called.");
|
||||
if (kvStorePtr_ == nullptr) {
|
||||
HILOGE("kvstore is null");
|
||||
return;
|
||||
}
|
||||
kvStorePtr_->GetEntries(allEntryKeyPrefix, networkId,
|
||||
[&resultStatusSignal, &allEntries](Status innerStatus, std::vector<Entry> innerAllEntries) {
|
||||
HILOGI("GetEntries, result = %{public}d", innerStatus);
|
||||
HILOGD("GetEntries, result = %{public}d", innerStatus);
|
||||
if (innerStatus == Status::SUCCESS) {
|
||||
std::copy(innerAllEntries.begin(), innerAllEntries.end(), std::back_inserter(allEntries));
|
||||
}
|
||||
resultStatusSignal.set_value(innerStatus);
|
||||
});
|
||||
HILOGI("end.");
|
||||
HILOGD("end.");
|
||||
}
|
||||
|
||||
bool DmsBmStorage::GetBundleNameId(const std::string& bundleName, uint16_t &bundleNameId)
|
||||
@ -963,7 +963,7 @@ std::string FindContinueType(const DmsBundleInfo& distributedBundleInfo, uint8_t
|
||||
std::string DmsBmStorage::GetContinueType(const std::string &networkId, std::string &bundleName,
|
||||
uint8_t continueTypeId)
|
||||
{
|
||||
HILOGI("called.");
|
||||
HILOGD("called.");
|
||||
HILOGD("networkId: %{public}s, bundleName: %{public}s, continueTypeId: %{public}d",
|
||||
GetAnonymStr(networkId).c_str(), bundleName.c_str(), continueTypeId);
|
||||
if (!CheckKvStore()) {
|
||||
@ -981,7 +981,7 @@ std::string DmsBmStorage::GetContinueType(const std::string &networkId, std::str
|
||||
int64_t begin = GetTickCount();
|
||||
GetEntries(networkId, allEntryKeyPrefix, resultStatusSignal, allEntries);
|
||||
Status status = GetResultSatus(resultStatusSignal);
|
||||
HILOGI("GetEntries spend %{public}" PRId64 " ms", GetTickCount() - begin);
|
||||
HILOGD("GetEntries spend %{public}" PRId64 " ms", GetTickCount() - begin);
|
||||
if (status != Status::SUCCESS) {
|
||||
HILOGE("GetEntries error: %{public}d", status);
|
||||
return "";
|
||||
@ -1031,7 +1031,7 @@ std::string FindModuleName(const DmsBundleInfo& distributedBundleInfo, std::stri
|
||||
std::string DmsBmStorage::GetAbilityName(const std::string &networkId, std::string &bundleName,
|
||||
std::string &continueType)
|
||||
{
|
||||
HILOGI("called.");
|
||||
HILOGD("called.");
|
||||
HILOGD("networkId: %{public}s, bundleName: %{public}s, continueTypeId: %{public}s",
|
||||
GetAnonymStr(networkId).c_str(), bundleName.c_str(), continueType.c_str());
|
||||
if (!CheckKvStore()) {
|
||||
@ -1049,7 +1049,7 @@ std::string DmsBmStorage::GetAbilityName(const std::string &networkId, std::stri
|
||||
int64_t begin = GetTickCount();
|
||||
GetEntries(networkId, allEntryKeyPrefix, resultStatusSignal, allEntries);
|
||||
Status status = GetResultSatus(resultStatusSignal);
|
||||
HILOGI("GetEntries spend %{public}" PRId64 " ms", GetTickCount() - begin);
|
||||
HILOGD("GetEntries spend %{public}" PRId64 " ms", GetTickCount() - begin);
|
||||
if (status != Status::SUCCESS) {
|
||||
HILOGE("GetEntries error: %{public}d", status);
|
||||
return "";
|
||||
@ -1128,7 +1128,7 @@ bool DmsBmStorage::GetContinueTypeId(const std::string &bundleName, const std::s
|
||||
bool DmsBmStorage::GetContinueEventInfo(const std::string &networkId, const std::string &bundleName,
|
||||
const std::string& continueType, ContinueEventInfo &continueEventInfo)
|
||||
{
|
||||
HILOGI("networkId: %{public}s, bundleName: %{public}s",
|
||||
HILOGD("networkId: %{public}s, bundleName: %{public}s",
|
||||
GetAnonymStr(networkId).c_str(), bundleName.c_str());
|
||||
if (!CheckKvStore()) {
|
||||
HILOGE("kvStore is nullptr");
|
||||
@ -1145,7 +1145,7 @@ bool DmsBmStorage::GetContinueEventInfo(const std::string &networkId, const std:
|
||||
int64_t begin = GetTickCount();
|
||||
GetEntries(networkId, allEntryKeyPrefix, resultStatusSignal, allEntries);
|
||||
Status status = GetResultSatus(resultStatusSignal);
|
||||
HILOGI("GetEntries spend %{public}" PRId64 " ms", GetTickCount() - begin);
|
||||
HILOGD("GetEntries spend %{public}" PRId64 " ms", GetTickCount() - begin);
|
||||
if (status != Status::SUCCESS) {
|
||||
HILOGE("GetEntries error: %{public}d", status);
|
||||
return false;
|
||||
@ -1158,7 +1158,7 @@ bool DmsBmStorage::GetContinueEventInfo(const std::string &networkId, const std:
|
||||
}
|
||||
DmsBundleInfo distributedBundleInfo;
|
||||
if (distributedBundleInfo.FromJsonString(value) && distributedBundleInfo.bundleName == bundleName) {
|
||||
HILOGI("value: %{public}s", value.c_str());
|
||||
HILOGD("value: %{public}s", value.c_str());
|
||||
continueEventInfo.networkId = networkId;
|
||||
continueEventInfo.bundleName = bundleName;
|
||||
continueEventInfo.developerId = distributedBundleInfo.developerId;
|
||||
|
@ -71,12 +71,12 @@ std::shared_ptr<DmsKvSyncE2E> DmsKvSyncE2E::GetInstance()
|
||||
|
||||
void DmsKvSyncE2E::SetDeviceCfg()
|
||||
{
|
||||
HILOGI("called.");
|
||||
HILOGD("called.");
|
||||
const char *syncType = "1";
|
||||
const int bufferLen = 10;
|
||||
char paramOutBuf[bufferLen] = {0};
|
||||
int ret = GetParameter(DETERMINE_DEVICE_TYPE_KEY, "", paramOutBuf, bufferLen);
|
||||
HILOGI("paramOutBuf: %{public}s, ret: %{public}d", paramOutBuf, ret);
|
||||
HILOGD("paramOutBuf: %{public}s, ret: %{public}d", paramOutBuf, ret);
|
||||
if (ret > 0 && strncmp(paramOutBuf, syncType, strlen(syncType)) == 0) {
|
||||
HILOGI("Determining the e2e device succeeded.");
|
||||
isCfgDevices_ = true;
|
||||
@ -97,15 +97,15 @@ void DmsKvSyncE2E::SetDeviceCfg()
|
||||
|
||||
bool DmsKvSyncE2E::CheckDeviceCfg()
|
||||
{
|
||||
HILOGI("called.");
|
||||
HILOGD("called.");
|
||||
return isCfgDevices_;
|
||||
}
|
||||
|
||||
bool DmsKvSyncE2E::CheckCtrlRule()
|
||||
{
|
||||
HILOGI("called.");
|
||||
HILOGD("called.");
|
||||
if (isCfgDevices_ && isForbidSendAndRecv_) {
|
||||
HILOGI("The device is a special device and checkCtrlRule fail");
|
||||
HILOGE("The device is a special device and checkCtrlRule fail");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -130,7 +130,7 @@ bool DmsKvSyncE2E::IsValidPath(const std::string &inFilePath, std::string &realF
|
||||
realFilePath = "";
|
||||
return false;
|
||||
}
|
||||
HILOGI("The real file path %{public}s exist in the file system.", GetAnonymStr(realFilePath).c_str());
|
||||
HILOGD("The real file path %{public}s exist in the file system.", GetAnonymStr(realFilePath).c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -176,19 +176,19 @@ bool DmsKvSyncE2E::UpdateWhiteList(const std::string &cfgJsonStr)
|
||||
|
||||
int32_t DmsKvSyncE2E::LoadContinueConfig()
|
||||
{
|
||||
HILOGI("Load continue config, continueCfgFullPath %{public}s.", GetAnonymStr(continueCfgFullPath_).c_str());
|
||||
HILOGD("Load continue config, continueCfgFullPath %{public}s.", GetAnonymStr(continueCfgFullPath_).c_str());
|
||||
std::string tempPath = continueCfgFullPath_;
|
||||
if ((continueCfgFullPath_.empty() || !IsValidPath(tempPath, continueCfgFullPath_))) {
|
||||
char cfgPathBuf[MAX_CONFIG_PATH_LEN] = { 0 };
|
||||
char *filePath = GetOneCfgFile(CONTINUE_CONFIG_RELATIVE_PATH.c_str(), cfgPathBuf, MAX_CONFIG_PATH_LEN);
|
||||
if (filePath == nullptr || filePath != cfgPathBuf) {
|
||||
HILOGI("Not find continue config file, relative path %{public}s.",
|
||||
HILOGE("Not find continue config file, relative path %{public}s.",
|
||||
GetAnonymStr(CONTINUE_CONFIG_RELATIVE_PATH).c_str());
|
||||
continueCfgFullPath_ = "";
|
||||
return ERR_OK;
|
||||
}
|
||||
continueCfgFullPath_ = std::string(filePath);
|
||||
HILOGI("Get Continue config file full path success, cfgFullPath %{public}s.",
|
||||
HILOGD("Get Continue config file full path success, cfgFullPath %{public}s.",
|
||||
GetAnonymStr(continueCfgFullPath_).c_str());
|
||||
}
|
||||
|
||||
@ -218,14 +218,14 @@ int32_t DmsKvSyncE2E::LoadContinueConfig()
|
||||
GetAnonymStr(continueCfgFullPath_).c_str());
|
||||
return DMS_PERMISSION_DENIED;
|
||||
}
|
||||
HILOGI("Load continue config success, cfgFullPath %{public}s.", GetAnonymStr(continueCfgFullPath_).c_str());
|
||||
HILOGD("Load continue config success, cfgFullPath %{public}s.", GetAnonymStr(continueCfgFullPath_).c_str());
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
bool DmsKvSyncE2E::CheckBundleContinueConfig(const std::string &bundleName)
|
||||
{
|
||||
if (!isCfgDevices_) {
|
||||
HILOGI("The device is a normal device");
|
||||
HILOGD("The device is a normal device");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -237,7 +237,7 @@ bool DmsKvSyncE2E::CheckBundleContinueConfig(const std::string &bundleName)
|
||||
return false;
|
||||
}
|
||||
|
||||
HILOGI("Current app is allow to continue in config file, bundleName %{public}s, cfgPath %{public}s.",
|
||||
HILOGD("Current app is allow to continue in config file, bundleName %{public}s, cfgPath %{public}s.",
|
||||
bundleName.c_str(), GetAnonymStr(continueCfgFullPath_).c_str());
|
||||
return true;
|
||||
}
|
||||
@ -340,7 +340,7 @@ bool DmsKvSyncE2E::CheckKvStore()
|
||||
|
||||
Status DmsKvSyncE2E::GetKvStore()
|
||||
{
|
||||
HILOGI("called.");
|
||||
HILOGD("called.");
|
||||
Options options = {
|
||||
.createIfMissing = true,
|
||||
.encrypt = false,
|
||||
@ -358,12 +358,12 @@ Status DmsKvSyncE2E::GetKvStore()
|
||||
};
|
||||
Status status = dataManager_.GetSingleKvStore(options, appId_, storeId_, kvStorePtr_);
|
||||
if (status == Status::SUCCESS) {
|
||||
HILOGI("get kvStore success");
|
||||
HILOGD("get kvStore success");
|
||||
} else if (status == DistributedKv::Status::STORE_META_CHANGED) {
|
||||
HILOGE("This db meta changed, remove and rebuild it");
|
||||
dataManager_.DeleteKvStore(appId_, storeId_, BMS_KV_BASE_DIR + appId_.appId);
|
||||
}
|
||||
HILOGI("end.");
|
||||
HILOGD("end.");
|
||||
return status;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user