diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/change_notification.cpp b/frameworks/innerkitsimpl/distributeddatafwk/src/change_notification.cpp index be622ed6db17c8d40db575a997055662a3dd8024..56a7547b2ca14624c0f98a56841f95b82fbf9f1c 100644 --- a/frameworks/innerkitsimpl/distributeddatafwk/src/change_notification.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/src/change_notification.cpp @@ -58,35 +58,42 @@ bool ChangeNotification::IsClear() const bool ChangeNotification::Marshalling(Parcel &parcel) const { if (!parcel.SetMaxCapacity(Constant::MAX_IPC_CAPACITY)) { + ZLOGE("SetMaxCapacity MAX_IPC_CAPACITY failed."); return false; } int32_t lenInsert = static_cast(insertEntries_.size()); if (!parcel.WriteInt32(lenInsert)) { + ZLOGE("WriteInt32 lenInsert failed."); return false; } for (const auto &entry : insertEntries_) { if (!parcel.WriteParcelable(&entry)) { + ZLOGE("WriteParcelable insertEntries_ entrys failed."); return false; } } int32_t lenUpdate = static_cast(updateEntries_.size()); if (!parcel.WriteInt32(lenUpdate)) { + ZLOGE("WriteInt32 lenUpdate failed."); return false; } for (const auto &entry : updateEntries_) { if (!parcel.WriteParcelable(&entry)) { + ZLOGE("WriteParcelable updateEntries_ entrys failed."); return false; } } int32_t lenDelete = static_cast(deleteEntries_.size()); if (!parcel.WriteInt32(lenDelete)) { + ZLOGE("WriteInt32 lenDelete failed."); return false; } for (const auto &entry : deleteEntries_) { if (!parcel.WriteParcelable(&entry)) { + ZLOGE("WriteParcelable deleteEntries_ entrys failed."); return false; } } @@ -105,7 +112,7 @@ ChangeNotification *ChangeNotification::Unmarshalling(Parcel &parcel) std::vector deleteEntries; int lenInsert = parcel.ReadInt32(); if (lenInsert < 0) { - ZLOGE("lenInsert is %d", lenInsert); + ZLOGE("lenInsert = %d", lenInsert); return nullptr; } for (int i = 0; i < lenInsert; i++) { @@ -119,7 +126,7 @@ ChangeNotification *ChangeNotification::Unmarshalling(Parcel &parcel) } int lenUpdate = parcel.ReadInt32(); if (lenUpdate < 0) { - ZLOGE("lenUpdate is %d", lenUpdate); + ZLOGE("lenUpdate = %d", lenUpdate); return nullptr; } for (int i = 0; i < lenUpdate; i++) { @@ -133,7 +140,7 @@ ChangeNotification *ChangeNotification::Unmarshalling(Parcel &parcel) } int lenDelete = parcel.ReadInt32(); if (lenDelete < 0) { - ZLOGE("lenDelete is %d", lenDelete); + ZLOGE("lenDelete = %d", lenDelete); return nullptr; } for (int i = 0; i < lenDelete; i++) { diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/distributed_kv_data_manager.cpp b/frameworks/innerkitsimpl/distributeddatafwk/src/distributed_kv_data_manager.cpp index c04019108b06c33a77889874accbad344d0b5cc2..0d9c8e0757b103c0307599c015a3702719d9e685 100644 --- a/frameworks/innerkitsimpl/distributeddatafwk/src/distributed_kv_data_manager.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/src/distributed_kv_data_manager.cpp @@ -59,13 +59,13 @@ Status DistributedKvDataManager::GetSingleKvStore(const Options &options, const status = kvDataServiceProxy->GetSingleKvStore(options, appId, storeId, [&](sptr proxy) { proxyTmp = std::move(proxy); }); if (status == Status::RECOVER_SUCCESS) { - ZLOGE("proxy recover success: %d", static_cast(status)); + ZLOGE("proxy recover success=%d", static_cast(status)); singleKvStore = std::make_shared(std::move(proxyTmp), storeIdTmp); return status; } if (status != Status::SUCCESS) { - ZLOGE("proxy return error: %d", static_cast(status)); + ZLOGE("proxy return error=%d", static_cast(status)); return status; } diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_data_service.cpp b/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_data_service.cpp index 620f36ab29bcd78cc13e43ee89d88ded583d8ae1..60ea0287c788911bed9de963b3fc9cf8cc9a18ac 100644 --- a/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_data_service.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_data_service.cpp @@ -37,7 +37,7 @@ KvStoreDataServiceProxy::KvStoreDataServiceProxy(const sptr &impl Status KvStoreDataServiceProxy::GetSingleKvStore(const Options &options, const AppId &appId, const StoreId &storeId, std::function)> callback) { - ZLOGI("%s %s", appId.appId.c_str(), storeId.storeId.c_str()); + ZLOGI("appId=%s storeId=%s", appId.appId.c_str(), storeId.storeId.c_str()); MessageParcel data; MessageParcel reply; if (!data.WriteInterfaceToken(KvStoreDataServiceProxy::GetDescriptor())) { @@ -72,7 +72,7 @@ Status KvStoreDataServiceProxy::GetSingleKvStore(const Options &options, const A MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(GETSINGLEKVSTORE, data, reply, mo); if (error != 0) { - ZLOGW("failed during IPC. errCode %d", error); + ZLOGW("failed during IPC. errCode=%d", error); return Status::IPC_ERROR; } Status status = static_cast(reply.ReadInt32()); @@ -105,7 +105,7 @@ void KvStoreDataServiceProxy::GetAllKvStoreId(const AppId &appId, MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(GETALLKVSTOREID, data, reply, mo); if (error != 0) { - ZLOGW("failed during IPC. errCode %d", error); + ZLOGW("failed during IPC. errCode=%d", error); callback(Status::IPC_ERROR, storeIds); return; } @@ -134,7 +134,7 @@ Status KvStoreDataServiceProxy::CloseKvStore(const AppId &appId, const StoreId & MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(CLOSEKVSTORE, data, reply, mo); if (error != 0) { - ZLOGW("failed during IPC. errCode %d", error); + ZLOGW("failed during IPC. errCode=%d", error); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -156,7 +156,7 @@ Status KvStoreDataServiceProxy::CloseAllKvStore(const AppId &appId) MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(CLOSEALLKVSTORE, data, reply, mo); if (error != 0) { - ZLOGW("failed during IPC. errCode %d", error); + ZLOGW("failed during IPC. errCode=%d", error); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -178,7 +178,7 @@ Status KvStoreDataServiceProxy::DeleteKvStore(const AppId &appId, const StoreId MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(DELETEKVSTORE, data, reply, mo); if (error != 0) { - ZLOGW("failed during IPC. errCode %d", error); + ZLOGW("failed during IPC. errCode=%d", error); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -200,7 +200,7 @@ Status KvStoreDataServiceProxy::DeleteAllKvStore(const AppId &appId) MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(DELETEALLKVSTORE, data, reply, mo); if (error != 0) { - ZLOGW("failed during IPC. errCode %d", error); + ZLOGW("failed during IPC. errCode=%d", error); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -224,13 +224,14 @@ Status KvStoreDataServiceProxy::RegisterClientDeathObserver(const AppId &appId, return Status::IPC_ERROR; } } else { + ZLOGW("observer is nullptr."); return Status::INVALID_ARGUMENT; } MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(REGISTERCLIENTDEATHOBSERVER, data, reply, mo); if (error != 0) { - ZLOGW("failed during IPC. errCode %d", error); + ZLOGW("failed during IPC. errCode=%d", error); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -247,7 +248,7 @@ Status KvStoreDataServiceProxy::GetLocalDevice(OHOS::DistributedKv::DeviceInfo & MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(GETLOCALDEVICE, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest returned %d", error); + ZLOGW("SendRequest returned=%d", error); return Status::IPC_ERROR; } Status status = static_cast(reply.ReadInt32()); @@ -272,7 +273,7 @@ Status KvStoreDataServiceProxy::GetRemoteDevices(std::vector &device MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(GETREMOTEDEVICES, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest returned %d", error); + ZLOGW("SendRequest returned=%d", error); return Status::IPC_ERROR; } Status status = static_cast(reply.ReadInt32()); @@ -304,16 +305,18 @@ Status KvStoreDataServiceProxy::StartWatchDeviceChange(sptrAsObject().GetRefPtr())) { + ZLOGW("WriteRemoteObject observer failed."); return Status::IPC_ERROR; } } else { + ZLOGW("observer is nullptr."); return Status::INVALID_ARGUMENT; } MessageParcel reply; MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(STARTWATCHDEVICECHANGE, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest returned %d", error); + ZLOGW("SendRequest returned=%d", error); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -328,16 +331,18 @@ Status KvStoreDataServiceProxy::StopWatchDeviceChange(sptrAsObject().GetRefPtr())) { + ZLOGW("WriteRemoteObject observer failed."); return Status::IPC_ERROR; } } else { + ZLOGW("observer is nullptr."); return Status::INVALID_ARGUMENT; } MessageParcel reply; MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(STOPWATCHDEVICECHANGE, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest returned %d", error); + ZLOGW("SendRequest returned=%d", error); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -356,7 +361,7 @@ sptr KvStoreDataServiceProxy::GetRdbService() MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(GET_RDB_SERVICE, data, reply, mo); if (error != 0) { - ZLOGE("SendRequest returned %{public}d", error); + ZLOGE("SendRequest returned=%{public}d", error); return nullptr; } auto remoteObject = reply.ReadRemoteObject(); @@ -404,10 +409,12 @@ int32_t KvStoreDataServiceStub::GetAllKvStoreIdOnRemote(MessageParcel &data, Mes }); if (!reply.WriteStringVector(storeIdList)) { + ZLOGW("write storeIdList failed."); return -1; } if (!reply.WriteInt32(static_cast(statusTmp))) { + ZLOGW("write statusTmp failed."); return -1; } return 0; @@ -418,15 +425,18 @@ int32_t KvStoreDataServiceStub::GetRemoteDevicesOnRemote(MessageParcel &data, Me DeviceFilterStrategy strategy = static_cast(data.ReadInt32()); Status status = GetRemoteDevices(infos, strategy); if (!reply.WriteInt32(static_cast(status))) { + ZLOGW("write status failed."); return -1; } if (status == Status::SUCCESS) { if (!reply.WriteInt32(infos.size())) { + ZLOGW("write infos failed."); return -1; } for (DeviceInfo const &info : infos) { if (!reply.WriteString(info.deviceId) || !reply.WriteString(info.deviceName) || !reply.WriteString(info.deviceType)) { + ZLOGW("write info failed."); return -1; } } @@ -447,6 +457,7 @@ int32_t KvStoreDataServiceStub::StartWatchDeviceChangeOnRemote(MessageParcel &da sptr observerProxy = iface_cast(remote); Status status = StartWatchDeviceChange(std::move(observerProxy), strategy); if (!reply.WriteInt32(static_cast(status))) { + ZLOGW("write status failed."); return -1; } return 0; @@ -464,6 +475,7 @@ int32_t KvStoreDataServiceStub::StopWatchDeviceChangeOnRemote(MessageParcel &dat sptr observerProxy = iface_cast(remote); Status status = StopWatchDeviceChange(std::move(observerProxy)); if (!reply.WriteInt32(static_cast(status))) { + ZLOGW("write status failed."); return -1; } return 0; @@ -497,10 +509,12 @@ int32_t KvStoreDataServiceStub::GetSingleKvStoreOnRemote(MessageParcel &data, Me Status status = GetSingleKvStore(options, appId, storeId, [&](sptr proxy) { proxyTmp = std::move(proxy); }); if (!reply.WriteInt32(static_cast(status))) { + ZLOGW("write status failed."); return -1; } if (status == Status::SUCCESS && proxyTmp != nullptr) { if (!reply.WriteRemoteObject(proxyTmp->AsObject().GetRefPtr())) { + ZLOGW("WriteRemoteObject proxyTmp failed."); return -1; } } @@ -513,6 +527,7 @@ int32_t KvStoreDataServiceStub::CloseKvStoreOnRemote(MessageParcel &data, Messag StoreId storeId = { Constant::TrimCopy(data.ReadString())}; Status status = CloseKvStore(appId, storeId); if (!reply.WriteInt32(static_cast(status))) { + ZLOGW("write status failed."); return -1; } return 0; @@ -523,6 +538,7 @@ int32_t KvStoreDataServiceStub::CloseAllKvStoreOnRemote(MessageParcel &data, Mes AppId appId = { Constant::TrimCopy(data.ReadString())}; Status status = CloseAllKvStore(appId); if (!reply.WriteInt32(static_cast(status))) { + ZLOGW("write status failed."); return -1; } return 0; @@ -534,6 +550,7 @@ int32_t KvStoreDataServiceStub::DeleteKvStoreOnRemote(MessageParcel &data, Messa StoreId storeId = { Constant::TrimCopy(data.ReadString())}; Status status = DeleteKvStore(appId, storeId); if (!reply.WriteInt32(static_cast(status))) { + ZLOGW("write status failed."); return -1; } return 0; @@ -544,6 +561,7 @@ int32_t KvStoreDataServiceStub::DeleteAllKvStoreOnRemote(MessageParcel &data, Me AppId appId = { Constant::TrimCopy(data.ReadString())}; Status status = DeleteAllKvStore(appId); if (!reply.WriteInt32(static_cast(status))) { + ZLOGW("write status failed."); return -1; } return 0; @@ -554,10 +572,12 @@ int32_t KvStoreDataServiceStub::RegisterClientDeathObserverOnRemote(MessageParce AppId appId = { Constant::TrimCopy(data.ReadString())}; sptr kvStoreClientDeathObserverProxy = data.ReadRemoteObject(); if (kvStoreClientDeathObserverProxy == nullptr) { + ZLOGW("kvStoreClientDeathObserverProxy is nullptr."); return -1; } Status status = RegisterClientDeathObserver(appId, std::move(kvStoreClientDeathObserverProxy)); if (!reply.WriteInt32(static_cast(status))) { + ZLOGW("write status failed."); return -1; } return 0; @@ -569,6 +589,7 @@ int32_t KvStoreDataServiceStub::GetLocalDeviceOnRemote(MessageParcel &data, Mess Status status = GetLocalDevice(info); if (!reply.WriteInt32(static_cast(status)) || !reply.WriteString(info.deviceId) || !reply.WriteString(info.deviceName) || !reply.WriteString(info.deviceType)) { + ZLOGW("write failed."); return -1; } return 0; diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_resultset.cpp b/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_resultset.cpp index e934a631f0dfc33ed038049c8d36512f157d9bf6..2e4d811e553036e4f715c1fd948fdc14399cd80d 100644 --- a/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_resultset.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_resultset.cpp @@ -80,12 +80,13 @@ bool KvStoreResultSetProxy::Move(int offset) } bool ret = data.WriteInt32(offset); if (!ret) { + ZLOGE("write offset failed"); return ret; } MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(MOVE, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest returned %d, code=%d", error, MOVE); + ZLOGW("SendRequest returned=%d, code=%d", error, MOVE); return false; } return reply.ReadBool(); @@ -100,12 +101,13 @@ bool KvStoreResultSetProxy::MoveToPosition(int position) } bool ret = data.WriteInt32(position); if (!ret) { + ZLOGE("write position failed"); return ret; } MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(MOVETOPOSITION, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest returned %d, code=%d", error, MOVETOPOSITION); + ZLOGW("SendRequest returned=%d, code=%d", error, MOVETOPOSITION); return false; } return reply.ReadBool(); @@ -148,13 +150,13 @@ Status KvStoreResultSetProxy::GetEntry(Entry &entry) ZLOGI("start"); int32_t error = Remote()->SendRequest(GETENTRY, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest failed, error is %d", error); + ZLOGW("SendRequest failed, error = %d", error); return Status::IPC_ERROR; } Status status = static_cast(reply.ReadInt32()); if (status != Status::SUCCESS) { - ZLOGW("status not success(%d)", static_cast(status)); + ZLOGW("status not successful, error=%d", static_cast(status)); return status; } sptr valueTmp = reply.ReadParcelable(); @@ -174,7 +176,7 @@ int KvStoreResultSetProxy::SendRequest(uint32_t code) MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(code, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest returned %d, code=%d", error, code); + ZLOGW("SendRequest returned=%d, code=%d", error, code); return -1; } return reply.ReadInt32(); @@ -190,7 +192,7 @@ bool KvStoreResultSetProxy::SendRequestRetBool(uint32_t code) MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(code, data, reply, mo); if (error != 0) { - ZLOGW("SendRequestRetBool returned %d, code=%d", error, code); + ZLOGW("SendRequestRetBool returned=%d, code=%d", error, code); return false; } return reply.ReadBool(); @@ -318,7 +320,7 @@ int KvStoreResultSetStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Me return GetEntryOnRemote(reply); } default: { - ZLOGW("OnRemoteRequest default %{public}u", code); + ZLOGW("OnRemoteRequest default=%{public}u", code); MessageOption mo { MessageOption::TF_SYNC }; return IPCObjectStub::OnRemoteRequest(code, data, reply, mo); } diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_single.cpp b/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_single.cpp index ee1133c7bfe5148e2dcebae35bb54827f59ba7c8..3627b0b60c3d153cc27417f25afc1ea3e63a704d 100644 --- a/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_single.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_single.cpp @@ -53,7 +53,7 @@ Status SingleKvStoreProxy::Put(const Key &key, const Value &value) } int error = Remote()->SendRequest(PUT, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest failed with error code %d", error); + ZLOGW("SendRequest failed with error code=%d", error); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -76,7 +76,7 @@ Status SingleKvStoreProxy::Put(const Key &key, const Value &value) // rawdata: keySize | key | ValueSize | value int32_t error = Remote()->SendRequest(PUT, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest returned %d", error); + ZLOGW("SendRequest returned=%d", error); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -97,7 +97,7 @@ Status SingleKvStoreProxy::Delete(const Key &key) MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(DELETE, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest returned %d", error); + ZLOGW("SendRequest returned=%d", error); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -121,12 +121,12 @@ Status SingleKvStoreProxy::Get(const Key &key, Value &value) MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(GET, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest failed, error is %d", error); + ZLOGW("SendRequest failed, error = %d", error); return Status::IPC_ERROR; } Status status = static_cast(reply.ReadInt32()); if (status != Status::SUCCESS) { - ZLOGW("status not success(%d)", static_cast(status)); + ZLOGW("status not successful, error=%d", static_cast(status)); return status; } @@ -166,6 +166,7 @@ Status SingleKvStoreProxy::SubscribeKvStore(const SubscribeType subscribeType, return Status::IPC_ERROR; } if (observer == nullptr) { + ZLOGE("observer is nullptr"); return Status::INVALID_ARGUMENT; } if (!data.WriteInt32(static_cast(subscribeType)) || @@ -176,7 +177,7 @@ Status SingleKvStoreProxy::SubscribeKvStore(const SubscribeType subscribeType, MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(SUBSCRIBEKVSTORE, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest returned %d", error); + ZLOGW("SendRequest returned=%d", error); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -192,6 +193,7 @@ Status SingleKvStoreProxy::UnSubscribeKvStore(const SubscribeType subscribeType, return Status::IPC_ERROR; } if (observer == nullptr) { + ZLOGE("observer is nullptr"); return Status::INVALID_ARGUMENT; } if (!data.WriteInt32(static_cast(subscribeType)) || @@ -203,7 +205,7 @@ Status SingleKvStoreProxy::UnSubscribeKvStore(const SubscribeType subscribeType, MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(UNSUBSCRIBEKVSTORE, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest returned %d", error); + ZLOGW("SendRequest returned=%d", error); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -224,12 +226,13 @@ Status SingleKvStoreProxy::GetEntries(const Key &prefixKey, std::vector & MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(GETENTRIES, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest failed, error is %d", error); + ZLOGW("SendRequest failed, error = %d", error); return Status::IPC_ERROR; } Status status = static_cast(reply.ReadInt32()); if (status != Status::SUCCESS) { + ZLOGW("ReadInt32 reply failed status=%d", status); return status; } @@ -250,7 +253,7 @@ Status SingleKvStoreProxy::GetEntries(const Key &prefixKey, std::vector & // this memory is managed by MassageParcel, DO NOT free here const uint8_t *buffer = reinterpret_cast(reply.ReadRawData(bufferSize)); if (replyEntryCount < 0 || bufferSize < 0 || buffer == nullptr) { - ZLOGW("replyEntryCount(%d) or bufferSize(%d) less than 0, or buffer is nullptr", replyEntryCount, + ZLOGW("replyEntryCount=%d or bufferSize=%d less than 0, or buffer is nullptr", replyEntryCount, bufferSize); return Status::IPC_ERROR; } @@ -290,12 +293,13 @@ Status SingleKvStoreProxy::GetEntriesWithQuery(const std::string &query, std::ve MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(GETENTRIESWITHQUERY, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest failed, error is %d", error); + ZLOGW("SendRequest failed, error = %d", error); return Status::IPC_ERROR; } Status status = static_cast(reply.ReadInt32()); if (status != Status::SUCCESS) { + ZLOGW("ReadInt32 reply failed status=%d", status); return status; } @@ -316,7 +320,7 @@ Status SingleKvStoreProxy::GetEntriesWithQuery(const std::string &query, std::ve // this memory is managed by MassageParcel, DO NOT free here const uint8_t *buffer = reinterpret_cast(reply.ReadRawData(bufferSize)); if (replyEntryCount < 0 || bufferSize < 0 || buffer == nullptr) { - ZLOGW("replyEntryCount(%d) or bufferSize(%d) less than 0, or buffer is nullptr", replyEntryCount, + ZLOGW("replyEntryCount=%d or bufferSize=%d less than 0, or buffer is nullptr", replyEntryCount, bufferSize); return Status::IPC_ERROR; } @@ -353,17 +357,19 @@ void SingleKvStoreProxy::GetResultSet(const Key &prefixKey, MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(GETRESULTSET, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest returned %d", error); + ZLOGW("SendRequest returned=%d", error); callback(Status::IPC_ERROR, nullptr); return; } Status status = static_cast(reply.ReadInt32()); if (status != Status::SUCCESS) { + ZLOGW("ReadInt32 reply failed status=%d", status); callback(status, nullptr); return; } sptr remote = reply.ReadRemoteObject(); if (remote == nullptr) { + ZLOGW("ReadRemoteObject reply failed"); callback(status, nullptr); return; } @@ -389,17 +395,19 @@ void SingleKvStoreProxy::GetResultSetWithQuery(const std::string &query, MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(GETRESULTSETWITHQUERY, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest returned %d", error); + ZLOGW("SendRequest returned=%d", error); callback(Status::IPC_ERROR, nullptr); return; } Status status = static_cast(reply.ReadInt32()); if (status != Status::SUCCESS) { + ZLOGW("ReadInt32 reply failed status=%d", status); callback(status, nullptr); return; } sptr remote = reply.ReadRemoteObject(); if (remote == nullptr) { + ZLOGW("ReadRemoteObject reply failed"); callback(status, nullptr); return; } @@ -424,12 +432,13 @@ Status SingleKvStoreProxy::GetCountWithQuery(const std::string &query, int &resu MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(GETCOUNTWITHQUERY, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest failed, error is %d", error); + ZLOGW("SendRequest failed, error = %d", error); return Status::IPC_ERROR; } Status status = static_cast(reply.ReadInt32()); if (status != Status::SUCCESS) { + ZLOGW("ReadInt32 reply failed status=%d", status); return status; } @@ -446,6 +455,7 @@ Status SingleKvStoreProxy::CloseResultSet(sptr resultSetPtr) return Status::IPC_ERROR; } if (resultSetPtr == nullptr) { + ZLOGW("resultSetPtr is nullptr"); return Status::INVALID_ARGUMENT; } @@ -456,7 +466,7 @@ Status SingleKvStoreProxy::CloseResultSet(sptr resultSetPtr) MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(CLOSERESULTSET, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest returned %d", error); + ZLOGW("SendRequest returned=%d", error); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -487,7 +497,7 @@ Status SingleKvStoreProxy::Sync(const std::vector &deviceIds, SyncM } int32_t error = Remote()->SendRequest(SYNC, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest returned %d", error); + ZLOGW("SendRequest returned=%d", error); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -518,7 +528,7 @@ Status SingleKvStoreProxy::Sync(const std::vector &deviceIds, SyncM MessageParcel reply; int32_t error = Remote()->SendRequest(SYNC_WITH_CONDITION, data, reply, mo); if (error != 0) { - ZLOGE("SendRequest returned %d", error); + ZLOGE("SendRequest returned=%d", error); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -540,7 +550,7 @@ Status SingleKvStoreProxy::RemoveDeviceData(const std::string &device) MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(REMOVEDEVICEDATA, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest returned %d", error); + ZLOGW("SendRequest returned=%d", error); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -566,7 +576,7 @@ Status SingleKvStoreProxy::RegisterSyncCallback(sptr callb MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(REGISTERSYNCCALLBACK, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest returned %d", error); + ZLOGW("SendRequest returned=%d", error); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -583,7 +593,7 @@ Status SingleKvStoreProxy::UnRegisterSyncCallback() MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(UNREGISTERSYNCCALLBACK, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest returned %d", error); + ZLOGW("SendRequest returned=%d", error); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -609,6 +619,7 @@ Status SingleKvStoreProxy::PutBatch(const std::vector &entries) int64_t bufferSize = 0; for (const auto &item : entries) { if (item.key.Size() > Constant::MAX_KEY_LENGTH || item.value.Size() > Constant::MAX_VALUE_LENGTH) { + ZLOGW("entry length is too long"); return Status::INVALID_ARGUMENT; } bufferSize += item.key.RawSize() + item.value.RawSize(); @@ -626,6 +637,7 @@ Status SingleKvStoreProxy::PutBatch(const std::vector &entries) } MessageOption mo { MessageOption::TF_SYNC }; if (Remote()->SendRequest(PUTBATCH, data, reply, mo) != 0) { + ZLOGW("Remote() SendRequest failed."); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -656,7 +668,7 @@ Status SingleKvStoreProxy::PutBatch(const std::vector &entries) MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(PUTBATCH, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest returned %d", error); + ZLOGW("SendRequest returned=%d", error); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -690,7 +702,7 @@ Status SingleKvStoreProxy::DeleteBatch(const std::vector &keys) MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(DELETEBATCH, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest returned %d", error); + ZLOGW("SendRequest returned=%d", error); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -706,7 +718,7 @@ Status SingleKvStoreProxy::StartTransaction() MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(STARTTRANSACTION, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest returned %d", error); + ZLOGW("SendRequest returned=%d", error); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -722,7 +734,7 @@ Status SingleKvStoreProxy::Commit() MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(COMMIT, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest returned %d", error); + ZLOGW("SendRequest returned=%d", error); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -738,7 +750,7 @@ Status SingleKvStoreProxy::Rollback() MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(ROLLBACK, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest returned %d", error); + ZLOGW("SendRequest returned=%d", error); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -767,12 +779,12 @@ Status SingleKvStoreProxy::Control(KvControlCmd cmd, const KvParam &inputParam, MessageOption mo{MessageOption::TF_SYNC}; int32_t error = Remote()->SendRequest(CONTROL, data, reply, mo); if (error != 0) { - ZLOGW("SendRequest failed, error is %d", error); + ZLOGW("SendRequest failed, error = %d", error); return Status::IPC_ERROR; } Status status = static_cast(reply.ReadInt32()); if (status != Status::SUCCESS) { - ZLOGW("status not success(%d)", static_cast(status)); + ZLOGW("status not successful, error=%d", static_cast(status)); return status; } @@ -883,7 +895,7 @@ Status SingleKvStoreProxy::Subscribe(const std::vector &deviceIds, MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(SUBSCRIBE, data, reply, mo); if (error != 0) { - ZLOGE("SendRequest returned %d", error); + ZLOGE("SendRequest returned=%d", error); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -913,7 +925,7 @@ Status SingleKvStoreProxy::UnSubscribe(const std::vector &deviceIds MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(UNSUBSCRIBE, data, reply, mo); if (error != 0) { - ZLOGE("SendRequest returned %d", error); + ZLOGE("SendRequest returned=%d", error); return Status::IPC_ERROR; } return static_cast(reply.ReadInt32()); @@ -968,6 +980,7 @@ int SingleKvStoreStub::PutOnRemote(MessageParcel &data, MessageParcel &reply) } Status status = Put(key, value); if (!reply.WriteInt32(static_cast(status))) { + ZLOGW("write status error"); return -1; } return 0; @@ -984,6 +997,7 @@ int SingleKvStoreStub::DeleteOnRemote(MessageParcel &data, MessageParcel &reply) } Status status = Delete(*key); if (!reply.WriteInt32(static_cast(status))) { + ZLOGW("write status error"); return -1; } return 0; @@ -1044,6 +1058,7 @@ int SingleKvStoreStub::SubscribeKvStoreOnRemote(MessageParcel &data, MessageParc SubscribeType subscribeType = static_cast(data.ReadInt32()); sptr remote = data.ReadRemoteObject(); if (remote == nullptr) { + ZLOGW("ReadRemoteObject reply failed"); if (!reply.WriteInt32(static_cast(Status::IPC_ERROR))) { return -1; } @@ -1053,6 +1068,7 @@ int SingleKvStoreStub::SubscribeKvStoreOnRemote(MessageParcel &data, MessageParc Status status = SubscribeKvStore(subscribeType, std::move(kvStoreObserverProxy)); if (!reply.WriteInt32(static_cast(status))) { + ZLOGW("write status error"); return -1; } return 0; @@ -1071,6 +1087,7 @@ int SingleKvStoreStub::UnSubscribeKvStoreOnRemote(MessageParcel &data, MessagePa sptr kvStoreObserverProxy = iface_cast(remote); Status status = UnSubscribeKvStore(subscribeType, std::move(kvStoreObserverProxy)); if (!reply.WriteInt32(static_cast(status))) { + ZLOGW("write status error"); return -1; } return 0; @@ -1119,6 +1136,7 @@ int SingleKvStoreStub::GetEntriesOnRemote(MessageParcel &data, MessageParcel &re std::vector entries; Status status = GetEntries(*keyPrefix, entries); if (status != Status::SUCCESS) { + ZLOGW("write status error"); if (!reply.WriteInt32(static_cast(status))) { return -1; } @@ -1131,7 +1149,7 @@ int SingleKvStoreStub::GetEntriesOnRemote(MessageParcel &data, MessageParcel &re } ZLOGI("getting large entry set"); if (bufferSize > static_cast(reply.GetRawDataCapacity())) { - ZLOGW("bufferSize %d larger than message parcel limit", bufferSize); + ZLOGW("bufferSize=%d larger than message parcel limit", bufferSize); if (!reply.WriteInt32(static_cast(Status::ERROR))) { return -1; } @@ -1177,6 +1195,7 @@ int SingleKvStoreStub::GetEntriesWithQueryOnRemote(MessageParcel &data, MessageP std::vector entries; Status status = GetEntriesWithQuery(query, entries); if (status != Status::SUCCESS) { + ZLOGW("write status error"); if (!reply.WriteInt32(static_cast(status))) { return -1; } @@ -1189,7 +1208,7 @@ int SingleKvStoreStub::GetEntriesWithQueryOnRemote(MessageParcel &data, MessageP } ZLOGI("getting large entry set"); if (bufferSize > static_cast(reply.GetRawDataCapacity())) { - ZLOGW("bufferSize %d larger than message parcel limit", bufferSize); + ZLOGW("bufferSize=%d larger than message parcel limit", bufferSize); if (!reply.WriteInt32(static_cast(Status::ERROR))) { return -1; } @@ -1230,7 +1249,7 @@ int SingleKvStoreStub::SyncOnRemote(MessageParcel &data, MessageParcel &reply) { std::vector devices; if (!data.ReadStringVector(&devices) || devices.empty()) { - ZLOGW("SYNC list:%zu", devices.size()); + ZLOGW("SYNC list=%zu", devices.size()); if (!reply.WriteInt32(static_cast(Status::INVALID_ARGUMENT))) { ZLOGW("write sync status fail"); return -1; @@ -1314,7 +1333,7 @@ int SingleKvStoreStub::PutBatchOnRemote(MessageParcel &data, MessageParcel &repl } int len = data.ReadInt32(); if (len < 0) { - ZLOGW("invalid status. len %d", len); + ZLOGW("invalid status. len=%d", len); if (!reply.WriteInt32(static_cast(Status::INVALID_ARGUMENT))) { ZLOGW("write to parcel failed."); return -1; @@ -1381,7 +1400,7 @@ int SingleKvStoreStub::DeleteBatchOnRemote(MessageParcel &data, MessageParcel &r { int len = data.ReadInt32(); if (len < 0) { - ZLOGW("len %d invalid after ipc", len); + ZLOGW("len=%d invalid after ipc", len); if (!reply.WriteInt32(static_cast(Status::INVALID_ARGUMENT))) { ZLOGW("write delete failed."); return -1; @@ -1486,6 +1505,7 @@ int SingleKvStoreStub::GetCountWithQueryOnRemote(MessageParcel &data, MessagePar int result; Status status = GetCountWithQuery(query, result); if (status != Status::SUCCESS) { + ZLOGW("get status failed."); if (!reply.WriteInt32(static_cast(status))) { return -1; } @@ -1502,6 +1522,7 @@ int SingleKvStoreStub::CloseResultSetOnRemote(MessageParcel &data, MessageParcel { sptr obj = data.ReadRemoteObject(); if (obj == nullptr) { + ZLOGW("ReadRemoteObject failed."); if (!reply.WriteInt32(static_cast(Status::INVALID_ARGUMENT))) { return -1; } @@ -1510,6 +1531,7 @@ int SingleKvStoreStub::CloseResultSetOnRemote(MessageParcel &data, MessageParcel sptr kvStoreResultSetProxy = iface_cast(obj); Status status = CloseResultSet(kvStoreResultSetProxy); if (!reply.WriteInt32(static_cast(status))) { + ZLOGW("write status failed."); return -1; } return 0; @@ -1606,7 +1628,7 @@ int SingleKvStoreStub::OnSyncRequest(MessageParcel &data, MessageParcel &reply) { std::vector devices; if (!data.ReadStringVector(&devices) || devices.empty()) { - ZLOGI("SYNC list:%zu", devices.size()); + ZLOGI("SYNC list=%zu", devices.size()); if (!reply.WriteInt32(static_cast(Status::INVALID_ARGUMENT))) { ZLOGE("write sync status fail"); return -1; @@ -1646,7 +1668,7 @@ int SingleKvStoreStub::OnSubscribeRequest(MessageParcel &data, MessageParcel &re { std::vector devices; if (!data.ReadStringVector(&devices) || devices.empty()) { - ZLOGE("SYNC list:%zu", devices.size()); + ZLOGE("SYNC list=%zu", devices.size()); if (!reply.WriteInt32(static_cast(Status::INVALID_ARGUMENT))) { ZLOGE("write sync status fail"); return -1; @@ -1667,7 +1689,7 @@ int SingleKvStoreStub::OnUnSubscribeRequest(MessageParcel &data, MessageParcel & { std::vector devices; if (!data.ReadStringVector(&devices) || devices.empty()) { - ZLOGE("SYNC list:%zu", devices.size()); + ZLOGE("SYNC list=%zu", devices.size()); if (!reply.WriteInt32(static_cast(Status::INVALID_ARGUMENT))) { ZLOGE("write sync status fail"); return -1; diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/itypes_util.cpp b/frameworks/innerkitsimpl/distributeddatafwk/src/itypes_util.cpp index da7fc65312ab34959d40c97b6f41ce39113d067e..fcc8490689ffa71c4bacea8621e12b211a53bcc5 100644 --- a/frameworks/innerkitsimpl/distributeddatafwk/src/itypes_util.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/src/itypes_util.cpp @@ -67,6 +67,7 @@ bool ITypesUtil::Unmarshalling(MessageParcel &data, Blob &output) bool ITypesUtil::Marshalling(const Entry &entry, MessageParcel &data) { if (!Marshalling(entry.key, data)) { + ZLOGW("Marshalling failed"); return false; } return Marshalling(entry.value, data); @@ -75,6 +76,7 @@ bool ITypesUtil::Marshalling(const Entry &entry, MessageParcel &data) bool ITypesUtil::Unmarshalling(MessageParcel &data, Entry &output) { if (!Unmarshalling(data, output.key)) { + ZLOGW("Unmarshalling failed"); return false; } return Unmarshalling(data, output.value); @@ -83,9 +85,11 @@ bool ITypesUtil::Unmarshalling(MessageParcel &data, Entry &output) bool ITypesUtil::Marshalling(const DeviceInfo &entry, MessageParcel &data) { if (!data.WriteString(entry.deviceId)) { + ZLOGW("write deviceId failed"); return false; } if (!data.WriteString(entry.deviceName)) { + ZLOGW("write deviceName failed"); return false; } return data.WriteString(entry.deviceType); @@ -94,9 +98,11 @@ bool ITypesUtil::Marshalling(const DeviceInfo &entry, MessageParcel &data) bool ITypesUtil::Unmarshalling(MessageParcel &data, DeviceInfo &output) { if (!data.ReadString(output.deviceId)) { + ZLOGW("read deviceId failed"); return false; } if (!data.ReadString(output.deviceName)) { + ZLOGW("read deviceName failed"); return false; } return data.ReadString(output.deviceType); @@ -105,14 +111,17 @@ bool ITypesUtil::Unmarshalling(MessageParcel &data, DeviceInfo &output) bool ITypesUtil::Marshalling(const ChangeNotification ¬ification, MessageParcel &parcel) { if (!Marshalling(notification.GetInsertEntries(), parcel)) { + ZLOGW("GetInsertEntries failed"); return false; } if (!Marshalling(notification.GetUpdateEntries(), parcel)) { + ZLOGW("GetUpdateEntries failed"); return false; } if (!Marshalling(notification.GetDeleteEntries(), parcel)) { + ZLOGW("GetDeleteEntries failed"); return false; } if (!parcel.WriteString(notification.GetDeviceId())) { @@ -127,14 +136,17 @@ bool ITypesUtil::Unmarshalling(MessageParcel &parcel, ChangeNotification &output { std::vector insertEntries; if (!Unmarshalling(parcel, insertEntries)) { + ZLOGW("insertEntries failed"); return false; } std::vector updateEntries; if (!Unmarshalling(parcel, updateEntries)) { + ZLOGW("updateEntries failed"); return false; } std::vector deleteEntries; if (!Unmarshalling(parcel, deleteEntries)) { + ZLOGW("deleteEntries failed"); return false; } std::string deviceId; @@ -413,6 +425,7 @@ int64_t ITypesUtil::GetTotalSize(const std::vector &entries) int64_t bufferSize = 1; for (const auto &item : entries) { if (item.key.Size() > Constant::MAX_KEY_LENGTH || item.value.Size() > Constant::MAX_VALUE_LENGTH) { + ZLOGW("entry length too long"); return -bufferSize; } bufferSize += item.key.RawSize() + item.value.RawSize(); @@ -425,6 +438,7 @@ int64_t ITypesUtil::GetTotalSize(const std::vector &entries) int64_t bufferSize = 1; for (const auto &item : entries) { if (item.Size() > Constant::MAX_KEY_LENGTH) { + ZLOGW("entry length too long"); return -bufferSize; } bufferSize += item.RawSize(); diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_service_death_notifier.cpp b/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_service_death_notifier.cpp index 15c2957ffa72a3c906422b2477c42a2cf1604da6..d7d86cedd5ca8b7c0f646b0d729ef3b3a5f790c9 100644 --- a/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_service_death_notifier.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_service_death_notifier.cpp @@ -79,6 +79,7 @@ sptr KvStoreServiceDeathNotifier::GetDistributedKvDataServi void KvStoreServiceDeathNotifier::RegisterClientDeathObserver() { if (kvDataServiceProxy_ == nullptr) { + ZLOGE("initialize proxy failed."); return; } if (clientDeathObserverPtr_ == nullptr) { @@ -96,9 +97,9 @@ void KvStoreServiceDeathNotifier::AddServiceDeathWatcher(std::shared_ptr lg(watchMutex_); auto ret = serviceDeathWatchers_.insert(std::move(watcher)); if (ret.second) { - ZLOGI("success set size: %zu", serviceDeathWatchers_.size()); + ZLOGI("success set size=%zu", serviceDeathWatchers_.size()); } else { - ZLOGE("failed set size: %zu", serviceDeathWatchers_.size()); + ZLOGE("failed set size=%zu", serviceDeathWatchers_.size()); } } @@ -108,9 +109,9 @@ void KvStoreServiceDeathNotifier::RemoveServiceDeathWatcher(std::shared_ptr lg(watchMutex_); kvDataServiceProxy_ = nullptr; - ZLOGI("watcher set size: %zu", serviceDeathWatchers_.size()); + ZLOGI("watcher set size=%zu", serviceDeathWatchers_.size()); for (const auto &watcher : serviceDeathWatchers_) { if (watcher == nullptr) { ZLOGI("watcher is nullptr"); diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/single_kvstore_client.cpp b/frameworks/innerkitsimpl/distributeddatafwk/src/single_kvstore_client.cpp index 1d5a1e4420e37d5188c89f44c4ef85fd952a2ed2..c21af40a77c7ab6b15eec370216e8d2c2f8ab6a9 100644 --- a/frameworks/innerkitsimpl/distributeddatafwk/src/single_kvstore_client.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/src/single_kvstore_client.cpp @@ -28,10 +28,13 @@ namespace OHOS::DistributedKv { SingleKvStoreClient::SingleKvStoreClient(sptr kvStoreProxy, const std::string &storeId) : kvStoreProxy_(kvStoreProxy), storeId_(storeId), syncCallbackClient_(new KvStoreSyncCallbackClient()), syncObserver_(std::make_shared()) -{} +{ + ZLOGI("constructor."); +} SingleKvStoreClient::~SingleKvStoreClient() { + ZLOGI("destructor."); kvStoreProxy_->UnRegisterSyncCallback(); syncObserver_->Clean(); } @@ -120,7 +123,7 @@ Status SingleKvStoreClient::GetResultSetWithQuery(const std::string &query, }; kvStoreProxy_->GetResultSetWithQuery(query, callFun); if (statusTmp != Status::SUCCESS) { - ZLOGE("return error: %d.", static_cast(statusTmp)); + ZLOGE("return error=%d.", static_cast(statusTmp)); return statusTmp; } @@ -226,7 +229,7 @@ Status SingleKvStoreClient::Put(const Key &key, const Value &value) { DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); - ZLOGI("key: %zu value: %zu.", key.Size(), value.Size()); + ZLOGI("key=%zu value=%zu.", key.Size(), value.Size()); std::vector keyData = Constant::TrimCopy>(key.Data()); if (keyData.size() == 0 || keyData.size() > Constant::MAX_KEY_LENGTH || value.Size() > Constant::MAX_VALUE_LENGTH) { @@ -349,7 +352,7 @@ Status SingleKvStoreClient::PutBatch(const std::vector &entries) { DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); - ZLOGI("entry size: %zu", entries.size()); + ZLOGI("entry size=%zu", entries.size()); if (entries.size() > Constant::MAX_BATCH_SIZE) { ZLOGE("batch size must less than 128."); return Status::INVALID_ARGUMENT; @@ -423,12 +426,14 @@ Status SingleKvStoreClient::GetSyncParam(KvSyncParam &syncParam) KvParam output; Status ret = Control(KvControlCmd::GET_SYNC_PARAM, inputEmpty, output); if (ret != Status::SUCCESS) { + ZLOGE("ret error=%d.", ret); return ret; } if (output.Size() == sizeof(uint32_t)) { syncParam.allowedDelayMs = TransferByteArrayToType(output.Data()); return Status::SUCCESS; } + ZLOGE("output size error."); return Status::ERROR; } diff --git a/frameworks/innerkitsimpl/rdb/src/rdb_manager_impl.cpp b/frameworks/innerkitsimpl/rdb/src/rdb_manager_impl.cpp index 4bf1584df8b6b443ec31fa199ea9a2a20986f185..017a7c190e1bb2212ff0f161cc35453fe9dc9d68 100644 --- a/frameworks/innerkitsimpl/rdb/src/rdb_manager_impl.cpp +++ b/frameworks/innerkitsimpl/rdb/src/rdb_manager_impl.cpp @@ -43,7 +43,7 @@ static sptr GetDistributedDataManager() std::this_thread::sleep_for(std::chrono::seconds(RdbManagerImpl::RETRY_INTERVAL)); continue; } - ZLOGI("get distributed data manager success"); + ZLOGI("get distributed data manager successful"); return iface_cast(remoteObject); } @@ -59,7 +59,7 @@ static void LinkToDeath(const sptr& remote) if (!remote->AddDeathRecipient(deathRecipient)) { ZLOGE("add death recipient failed"); } - ZLOGE("success"); + ZLOGE("successful"); } RdbManagerImpl::RdbManagerImpl() @@ -104,6 +104,7 @@ std::shared_ptr RdbManagerImpl::GetRdbService(const RdbSyncerParam& } auto service = GetRdbService(); if (service == nullptr) { + ZLOGE("get rdb service is nullptr"); return nullptr; } if (service->InitNotifier(param) != RDB_OK) { @@ -129,10 +130,12 @@ void RdbManagerImpl::OnRemoteDied() param.bundleName_ = bundleName_; auto service = GetRdbService(param); if (service == nullptr) { + ZLOGI("rdb service alreadly dead"); return; } proxy = std::static_pointer_cast(service); if (proxy == nullptr) { + ZLOGI("rdb service proxy alreadly dead"); return; } ZLOGI("restore observer"); diff --git a/frameworks/innerkitsimpl/rdb/src/rdb_notifier.cpp b/frameworks/innerkitsimpl/rdb/src/rdb_notifier.cpp index b263a4bf2db208832fd35eac8c0b9fae4fea4b80..a3eded4924c79d2f5e765dfa1d9719c8a349c0d4 100644 --- a/frameworks/innerkitsimpl/rdb/src/rdb_notifier.cpp +++ b/frameworks/innerkitsimpl/rdb/src/rdb_notifier.cpp @@ -45,6 +45,7 @@ int32_t RdbNotifierProxy::OnComplete(uint32_t seqNum, const SyncResult &result) return RDB_ERROR; } if (!DistributedKv::ITypesUtil::Marshalling(result, data)) { + ZLOGE("marshalling result and data failed"); return RDB_ERROR; } @@ -108,8 +109,9 @@ bool RdbNotifierStub::CheckInterfaceToken(MessageParcel& data) int RdbNotifierStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - ZLOGD("code:%{public}u, callingPid:%{public}d", code, IPCSkeleton::GetCallingPid()); + ZLOGI("code=%{public}u", code); if (!CheckInterfaceToken(data)) { + ZLOGE("CheckInterfaceToken data error."); return RDB_ERROR; } diff --git a/frameworks/innerkitsimpl/rdb/src/rdb_service_proxy.cpp b/frameworks/innerkitsimpl/rdb/src/rdb_service_proxy.cpp index 53c93569767c7a9a0f6ad0dfd4a6d617eb1e2206..d2aecaed04ce1170f3982585ba92b38074f77899 100644 --- a/frameworks/innerkitsimpl/rdb/src/rdb_service_proxy.cpp +++ b/frameworks/innerkitsimpl/rdb/src/rdb_service_proxy.cpp @@ -92,7 +92,7 @@ int32_t RdbServiceProxy::InitNotifier(const RdbSyncerParam& param) return RDB_ERROR; } - ZLOGI("success"); + ZLOGI("successful"); return RDB_OK; } @@ -167,10 +167,10 @@ int32_t RdbServiceProxy::DoSync(const RdbSyncerParam& param, const SyncOption &o { SyncResult result; if (DoSync(param, option, predicates, result) != RDB_OK) { - ZLOGI("failed"); + ZLOGE("dosync failed"); return RDB_ERROR; } - ZLOGI("success"); + ZLOGI("successful"); if (callback != nullptr) { callback(result); @@ -224,12 +224,12 @@ int32_t RdbServiceProxy::DoAsync(const RdbSyncerParam& param, const SyncOption & ZLOGI("num=%{public}u", num); if (DoAsync(param, num, option, predicates) != RDB_OK) { - ZLOGE("failed"); + ZLOGE("do async failed"); syncCallbacks_.Erase(num); return RDB_ERROR; } - ZLOGI("success"); + ZLOGI("successful"); return RDB_OK; } @@ -264,6 +264,7 @@ int32_t RdbServiceProxy::Sync(const RdbSyncerParam& param, const SyncOption &opt const RdbPredicates &predicates, const SyncCallback &callback) { if (option.isBlock) { + ZLOGI("option isBlock"); return DoSync(param, option, predicates, callback); } return DoAsync(param, option, predicates, callback); @@ -277,7 +278,7 @@ int32_t RdbServiceProxy::Subscribe(const RdbSyncerParam ¶m, const SubscribeO return RDB_ERROR; } if (DoSubscribe(param) != RDB_OK) { - ZLOGI("communicate to server failed"); + ZLOGE("communicate to server failed"); return RDB_ERROR; } observers_.Compute( diff --git a/frameworks/jskitsimpl/distributeddata/src/entry_point.cpp b/frameworks/jskitsimpl/distributeddata/src/entry_point.cpp index d3f105d41207b0240099f4f9ae08b5960c9e7f1d..8d922e98c10b9c8beeb47a78349b75c19a6492a8 100644 --- a/frameworks/jskitsimpl/distributeddata/src/entry_point.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/entry_point.cpp @@ -29,19 +29,19 @@ static napi_value Init(napi_env env, napi_value exports) DECLARE_NAPI_FUNCTION("createKVManager", JsKVManager::CreateKVManager) }; napi_status status = napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc); - ZLOGI("init createKVManager %{public}d", status); + ZLOGI("init createKVManager status=%{public}d", status); status = napi_set_named_property(env, exports, "FieldNode", JsFieldNode::Constructor(env)); - ZLOGI("init FieldNode %{public}d", status); + ZLOGI("init FieldNode status=%{public}d", status); status = napi_set_named_property(env, exports, "Schema", JsSchema::Constructor(env)); - ZLOGI("init Schema %{public}d", status); + ZLOGI("init Schema status=%{public}d", status); status = napi_set_named_property(env, exports, "Query", JsQuery::Constructor(env)); - ZLOGI("init Query %{public}d", status); + ZLOGI("init Query status=%{public}d", status); status = InitConstProperties(env, exports); - ZLOGI("init Enumerate Constants %{public}d", status); + ZLOGI("init Enumerate Constants status=%{public}d", status); return exports; } diff --git a/frameworks/jskitsimpl/distributeddata/src/js_device_kv_store.cpp b/frameworks/jskitsimpl/distributeddata/src/js_device_kv_store.cpp index b28b62e5154fab499e6d84b0dc647776d7544ce7..51bf3a11504828383504c9688145273008259a1a 100644 --- a/frameworks/jskitsimpl/distributeddata/src/js_device_kv_store.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/js_device_kv_store.cpp @@ -38,10 +38,12 @@ static std::string GetDeviceKey(const std::string& deviceId, const std::string& JsDeviceKVStore::JsDeviceKVStore(const std::string& storeId) : JsKVStore(storeId) { + ZLOGD("constructor"); } napi_value JsDeviceKVStore::Constructor(napi_env env) { + ZLOGD("JsDeviceKVStore::Constructor"); const napi_property_descriptor properties[] = { DECLARE_NAPI_FUNCTION("put", JsKVStore::Put), DECLARE_NAPI_FUNCTION("delete", JsKVStore::Delete), @@ -104,7 +106,7 @@ napi_value JsDeviceKVStore::Get(napi_env env, napi_callback_info info) return; } Status status = kvStore->Get(key, value); - ZLOGD("kvStore->Get return %{public}d", status); + ZLOGD("kvStore->Get return status=%{public}d", status); ctxt->value = JSUtil::Blob2VariantValue(value); ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; CHECK_STATUS_RETURN_VOID(ctxt, "kvStore->Get() failed!"); @@ -196,16 +198,16 @@ napi_value JsDeviceKVStore::GetEntries(napi_env env, napi_callback_info info) std::string deviceKey = GetDeviceKey(ctxt->va.deviceId, ctxt->va.keyPrefix); OHOS::DistributedKv::Key keyPrefix(deviceKey); status = kvStore->GetEntries(keyPrefix, ctxt->entries); - ZLOGD("kvStore->GetEntries() return %{public}d", status); + ZLOGD("kvStore->GetEntries() return status=%{public}d", status); } else if (ctxt->va.type == ArgsType::DEVICEID_QUERY) { auto query = ctxt->va.query->GetNative(); query.DeviceId(ctxt->va.deviceId); status = kvStore->GetEntriesWithQuery(query.ToString(), ctxt->entries); - ZLOGD("kvStore->GetEntriesWithQuery() return %{public}d", status); + ZLOGD("kvStore->GetEntriesWithQuery() return status=%{public}d", status); } else if (ctxt->va.type == ArgsType::QUERY) { auto query = ctxt->va.query->GetNative(); status = kvStore->GetEntriesWithQuery(query.ToString(), ctxt->entries); - ZLOGD("kvStore->GetEntriesWithQuery() return %{public}d", status); + ZLOGD("kvStore->GetEntriesWithQuery() return status=%{public}d", status); } ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; CHECK_STATUS_RETURN_VOID(ctxt, "kvStore->GetEntries() failed!"); @@ -254,16 +256,16 @@ napi_value JsDeviceKVStore::GetResultSet(napi_env env, napi_callback_info info) std::string deviceKey = GetDeviceKey(ctxt->va.deviceId, ctxt->va.keyPrefix); OHOS::DistributedKv::Key keyPrefix(deviceKey); status = kvStore->GetResultSet(keyPrefix, kvResultSet); - ZLOGD("kvStore->GetEntries() return %{public}d", status); + ZLOGD("kvStore->GetEntries() return status=%{public}d", status); } else if (ctxt->va.type == ArgsType::DEVICEID_QUERY) { auto query = ctxt->va.query->GetNative(); query.DeviceId(ctxt->va.deviceId); status = kvStore->GetResultSetWithQuery(query.ToString(), kvResultSet); - ZLOGD("kvStore->GetEntriesWithQuery() return %{public}d", status); + ZLOGD("kvStore->GetEntriesWithQuery() return status=%{public}d", status); } else if (ctxt->va.type == ArgsType::QUERY) { auto query = ctxt->va.query->GetNative(); status = kvStore->GetResultSetWithQuery(query.ToString(), kvResultSet); - ZLOGD("kvStore->GetEntriesWithQuery() return %{public}d", status); + ZLOGD("kvStore->GetEntriesWithQuery() return status=%{public}d", status); } ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; CHECK_STATUS_RETURN_VOID(ctxt, "kvStore->GetResultSet() failed!"); @@ -304,7 +306,7 @@ napi_value JsDeviceKVStore::CloseResultSet(napi_env env, napi_callback_info info auto execute = [ctxt]() { auto& kvStore = reinterpret_cast(ctxt->native)->GetNative(); Status status = kvStore->CloseResultSet(ctxt->resultSet->GetNative()); - ZLOGD("kvStore->CloseResultSet return %{public}d", status); + ZLOGD("kvStore->CloseResultSet return status=%{public}d", status); ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; CHECK_STATUS_RETURN_VOID(ctxt, "kvStore->CloseResultSet failed!"); }; @@ -342,7 +344,7 @@ napi_value JsDeviceKVStore::GetResultSize(napi_env env, napi_callback_info info) query.DeviceId(ctxt->va.deviceId); } Status status = kvStore->GetCountWithQuery(query.ToString(), ctxt->resultSize); - ZLOGD("kvStore->GetCountWithQuery() return %{public}d", status); + ZLOGD("kvStore->GetCountWithQuery() return status=%{public}d", status); ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; CHECK_STATUS_RETURN_VOID(ctxt, "kvStore->GetCountWithQuery() failed!"); }; @@ -376,7 +378,7 @@ napi_value JsDeviceKVStore::RemoveDeviceData(napi_env env, napi_callback_info in auto execute = [ctxt]() { auto& kvStore = reinterpret_cast(ctxt->native)->GetNative(); Status status = kvStore->RemoveDeviceData(ctxt->deviceId); - ZLOGD("kvStore->RemoveDeviceData return %{public}d", status); + ZLOGD("kvStore->RemoveDeviceData return status=%{public}d", status); ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; CHECK_STATUS_RETURN_VOID(ctxt, "kvStore->RemoveDeviceData() failed!"); }; @@ -389,6 +391,7 @@ napi_value JsDeviceKVStore::RemoveDeviceData(napi_env env, napi_callback_info in */ napi_value JsDeviceKVStore::Sync(napi_env env, napi_callback_info info) { + ZLOGD("JsDeviceKVStore::Sync"); struct SyncContext : public ContextBase { std::vector deviceIdList; uint32_t mode = 0; @@ -408,7 +411,7 @@ napi_value JsDeviceKVStore::Sync(napi_env env, napi_callback_info info) auto& kvStore = reinterpret_cast(ctxt->native)->GetNative(); Status status = kvStore->Sync(ctxt->deviceIdList, static_cast(ctxt->mode)); - ZLOGD("kvStore->Sync return %{public}d!", status); + ZLOGD("kvStore->Sync return status=%{public}d!", status); NAPI_ASSERT(env, status == Status::SUCCESS, "kvStore->Sync() failed!"); return nullptr; } diff --git a/frameworks/jskitsimpl/distributeddata/src/js_field_node.cpp b/frameworks/jskitsimpl/distributeddata/src/js_field_node.cpp index 186f070dd5f7a004162076eadcafc318ce10fa97..671bf02b5d0696b6ddbe70e4006e68f7ead7bd33 100644 --- a/frameworks/jskitsimpl/distributeddata/src/js_field_node.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/js_field_node.cpp @@ -41,6 +41,7 @@ std::map JsFieldNode::valueTypeToString_ = { JsFieldNode::JsFieldNode(const std::string& fName) : fieldName(fName) { + ZLOGD("constructor"); } std::string JsFieldNode::GetFieldName() @@ -63,6 +64,7 @@ JsFieldNode::json JsFieldNode::GetValueForJson() napi_value JsFieldNode::Constructor(napi_env env) { + ZLOGD("JsFieldNode::Constructor"); const napi_property_descriptor properties[] = { DECLARE_NAPI_FUNCTION("appendChild", JsFieldNode::AppendChild), DECLARE_NAPI_GETTER_SETTER("default", JsFieldNode::GetDefaultValue, JsFieldNode::SetDefaultValue), @@ -254,6 +256,7 @@ std::string JsFieldNode::ValueTypeToString(uint32_t type) // DistributedDB::FieldType auto it = valueTypeToString_.find(type); if (valueTypeToString_.find(type) != valueTypeToString_.end()) { + ZLOGD("find type is the last"); return it->second; } else { return std::string(); diff --git a/frameworks/jskitsimpl/distributeddata/src/js_kv_manager.cpp b/frameworks/jskitsimpl/distributeddata/src/js_kv_manager.cpp index 68238a2575fd448fe3d16b68922edfa9bcdf6d86..279dd0f031d53661b308c697b964cdb712f5e13c 100644 --- a/frameworks/jskitsimpl/distributeddata/src/js_kv_manager.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/js_kv_manager.cpp @@ -129,7 +129,7 @@ napi_value JsKVManager::GetKVStore(napi_env env, napi_callback_info info) StoreId storeId = { ctxt->storeId }; std::shared_ptr kvStore; Status status = kvm->kvDataManager_.GetSingleKvStore(ctxt->options, appId, storeId, kvStore); - ZLOGD("GetSingleKvStore return status:%{public}d", status); + ZLOGD("GetSingleKvStore return status=%{public}d", status); ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; CHECK_STATUS_RETURN_VOID(ctxt, "KVManager->GetSingleKvStore() failed!"); ctxt->kvStore->SetNative(kvStore); @@ -175,7 +175,7 @@ napi_value JsKVManager::CloseKVStore(napi_env env, napi_callback_info info) AppId appId { ctxt->appId }; StoreId storeId { ctxt->storeId }; Status status = reinterpret_cast(ctxt->native)->kvDataManager_.CloseKvStore(appId, storeId); - ZLOGD("CloseKVStore return status:%{public}d", status); + ZLOGD("CloseKVStore return status=%{public}d", status); ctxt->status = ((status == Status::SUCCESS) || (status == Status::STORE_NOT_FOUND) || (status == Status::STORE_NOT_OPEN)) ? napi_ok @@ -212,7 +212,7 @@ napi_value JsKVManager::DeleteKVStore(napi_env env, napi_callback_info info) AppId appId { ctxt->appId }; StoreId storeId { ctxt->storeId }; Status status = reinterpret_cast(ctxt->native)->kvDataManager_.DeleteKvStore(appId, storeId); - ZLOGD("DeleteKvStore status:%{public}d", status); + ZLOGD("DeleteKvStore status=%{public}d", status); ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; }; return NapiQueue::AsyncWork(env, ctxt, std::string(__FUNCTION__), execute); @@ -245,25 +245,26 @@ napi_value JsKVManager::GetAllKVStoreId(napi_env env, napi_callback_info info) CHECK_ARGS_RETURN_VOID(ctxt, kvm != nullptr, "KVManager is null, failed!"); AppId appId { ctxt->appId }; Status status = kvm->kvDataManager_.GetAllKvStoreId(appId, ctxt->storeIdList); - ZLOGD("execute status:%{public}d", status); + ZLOGD("execute status=%{public}d", status); ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; }; auto output = [env, ctxt](napi_value& result) { ctxt->status = JSUtil::SetValue(env, ctxt->storeIdList, result); - ZLOGD("output status:%{public}d", ctxt->status); + ZLOGD("output status=%{public}d", ctxt->status); }; return NapiQueue::AsyncWork(env, ctxt, std::string(__FUNCTION__), execute, output); } napi_value JsKVManager::On(napi_env env, napi_callback_info info) { + ZLOGD("KVManager::On()"); auto ctxt = std::make_shared(); auto input = [env, ctxt](size_t argc, napi_value* argv) { // required 2 arguments :: CHECK_ARGS_RETURN_VOID(ctxt, argc == 2, "invalid arguments!"); std::string event; ctxt->status = JSUtil::GetValue(env, argv[0], event); - ZLOGI("subscribe to event:%{public}s", event.c_str()); + ZLOGI("subscribe to event=%{public}s", event.c_str()); CHECK_ARGS_RETURN_VOID(ctxt, event == "distributedDataServiceDie", "invalid arg[0], i.e. invalid event!"); napi_valuetype valueType = napi_undefined; @@ -301,7 +302,7 @@ napi_value JsKVManager::Off(napi_env env, napi_callback_info info) std::string event; ctxt->status = JSUtil::GetValue(env, argv[0], event); // required 1 arguments :: - ZLOGI("unsubscribe to event:%{public}s %{public}s specified", event.c_str(), (argc == 1) ? "without": "with"); + ZLOGI("unsubscribe to event=%{public}s %{public}s specified", event.c_str(), (argc == 1) ? "without": "with"); CHECK_ARGS_RETURN_VOID(ctxt, event == "distributedDataServiceDie", "invalid arg[0], i.e. invalid event!"); // have 2 arguments :: have the [callback] if (argc == 2) { @@ -323,7 +324,7 @@ napi_value JsKVManager::Off(napi_env env, napi_callback_info info) ++it; } } - ZLOGD("off mapsize: %{public}d", static_cast(proxy->deathRecipient_.size())); + ZLOGD("off mapsize=%{public}d", static_cast(proxy->deathRecipient_.size())); }; ctxt->GetCbInfoSync(env, info, input); NAPI_ASSERT(env, ctxt->status == napi_ok, "invalid arguments!"); @@ -333,6 +334,7 @@ napi_value JsKVManager::Off(napi_env env, napi_callback_info info) napi_value JsKVManager::Constructor(napi_env env) { + ZLOGD("KVManager::Constructor"); const napi_property_descriptor properties[] = { DECLARE_NAPI_FUNCTION("getKVStore", JsKVManager::GetKVStore), DECLARE_NAPI_FUNCTION("closeKVStore", JsKVManager::CloseKVStore), @@ -347,6 +349,7 @@ napi_value JsKVManager::Constructor(napi_env env) napi_value JsKVManager::New(napi_env env, napi_callback_info info) { + ZLOGD("KVManager::New"); std::string bundleName; auto ctxt = std::make_shared(); auto input = [env, ctxt, &bundleName](size_t argc, napi_value* argv) { diff --git a/frameworks/jskitsimpl/distributeddata/src/js_kv_store.cpp b/frameworks/jskitsimpl/distributeddata/src/js_kv_store.cpp index 13bc8d7be0393faf12556d159f76729a874005b1..323bf056d9fd59d261b77772d1003879fc287cba 100644 --- a/frameworks/jskitsimpl/distributeddata/src/js_kv_store.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/js_kv_store.cpp @@ -182,7 +182,7 @@ napi_value JsKVStore::OnEvent(napi_env env, napi_callback_info info) CHECK_ARGS_RETURN_VOID(ctxt, argc >= 2, "invalid arguments!"); std::string event; ctxt->status = JSUtil::GetValue(env, argv[0], event); - ZLOGI("subscribe to event:%{public}s", event.c_str()); + ZLOGI("subscribe to event=%{public}s", event.c_str()); auto handle = onEventHandlers_.find(event); CHECK_ARGS_RETURN_VOID(ctxt, handle != onEventHandlers_.end(), "invalid arg[0], i.e. unsupported event"); // shift 1 argument, for JsKVStore::Exec. @@ -208,7 +208,7 @@ napi_value JsKVStore::OffEvent(napi_env env, napi_callback_info info) CHECK_ARGS_RETURN_VOID(ctxt, argc >= 1, "invalid arguments!"); std::string event; ctxt->status = JSUtil::GetValue(env, argv[0], event); - ZLOGI("unsubscribe to event:%{public}s", event.c_str()); + ZLOGI("unsubscribe to event=%{public}s", event.c_str()); auto handle = offEventHandlers_.find(event); CHECK_ARGS_RETURN_VOID(ctxt, handle != offEventHandlers_.end(), "invalid arg[0], i.e. unsupported event"); // shift 1 argument, for JsKVStore::Exec. @@ -228,6 +228,7 @@ napi_value JsKVStore::OffEvent(napi_env env, napi_callback_info info) */ napi_value JsKVStore::PutBatch(napi_env env, napi_callback_info info) { + ZLOGD("in"); struct PutBatchContext : public ContextBase { std::vector entries; }; @@ -259,6 +260,7 @@ napi_value JsKVStore::PutBatch(napi_env env, napi_callback_info info) */ napi_value JsKVStore::DeleteBatch(napi_env env, napi_callback_info info) { + ZLOGD("in"); struct DeleteBatchContext : public ContextBase { std::vector keys; }; @@ -279,7 +281,7 @@ napi_value JsKVStore::DeleteBatch(napi_env env, napi_callback_info info) } auto& kvStore = reinterpret_cast(ctxt->native)->kvStore_; Status status = kvStore->DeleteBatch(keys); - ZLOGD("kvStore->DeleteBatch return %{public}d", status); + ZLOGD("kvStore->DeleteBatch return status=%{public}d", status); ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; CHECK_STATUS_RETURN_VOID(ctxt, "kvStore->DeleteBatch failed!"); }; @@ -295,13 +297,14 @@ napi_value JsKVStore::DeleteBatch(napi_env env, napi_callback_info info) */ napi_value JsKVStore::StartTransaction(napi_env env, napi_callback_info info) { + ZLOGD("in"); auto ctxt = std::make_shared(); ctxt->GetCbInfo(env, info); auto execute = [ctxt]() { auto& kvStore = reinterpret_cast(ctxt->native)->kvStore_; Status status = kvStore->StartTransaction(); - ZLOGD("kvStore->StartTransaction return %{public}d", status); + ZLOGD("kvStore->StartTransaction return status=%{public}d", status); ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; CHECK_STATUS_RETURN_VOID(ctxt, "kvStore->StartTransaction() failed!"); }; @@ -317,13 +320,14 @@ napi_value JsKVStore::StartTransaction(napi_env env, napi_callback_info info) */ napi_value JsKVStore::Commit(napi_env env, napi_callback_info info) { + ZLOGD("in"); auto ctxt = std::make_shared(); ctxt->GetCbInfo(env, info); auto execute = [ctxt]() { auto& kvStore = reinterpret_cast(ctxt->native)->kvStore_; Status status = kvStore->Commit(); - ZLOGD("kvStore->Commit return %{public}d", status); + ZLOGD("kvStore->Commit return status=%{public}d", status); ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; CHECK_STATUS_RETURN_VOID(ctxt, "kvStore->Commit() failed!"); }; @@ -339,13 +343,14 @@ napi_value JsKVStore::Commit(napi_env env, napi_callback_info info) */ napi_value JsKVStore::Rollback(napi_env env, napi_callback_info info) { + ZLOGD("in"); auto ctxt = std::make_shared(); ctxt->GetCbInfo(env, info); auto execute = [ctxt]() { auto& kvStore = reinterpret_cast(ctxt->native)->kvStore_; Status status = kvStore->Rollback(); - ZLOGD("kvStore->Commit return %{public}d", status); + ZLOGD("kvStore->Commit return status=%{public}d", status); ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; CHECK_STATUS_RETURN_VOID(ctxt, "kvStore->Rollback() failed!"); }; @@ -361,6 +366,7 @@ napi_value JsKVStore::Rollback(napi_env env, napi_callback_info info) */ napi_value JsKVStore::EnableSync(napi_env env, napi_callback_info info) { + ZLOGD("in"); struct EnableSyncContext : public ContextBase { bool enable = false; }; @@ -376,7 +382,7 @@ napi_value JsKVStore::EnableSync(napi_env env, napi_callback_info info) auto execute = [ctxt]() { auto& kvStore = reinterpret_cast(ctxt->native)->kvStore_; Status status = kvStore->SetCapabilityEnabled(ctxt->enable); - ZLOGD("kvStore->SetCapabilityEnabled return %{public}d", status); + ZLOGD("kvStore->SetCapabilityEnabled return status=%{public}d", status); ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; CHECK_STATUS_RETURN_VOID(ctxt, "kvStore->SetCapabilityEnabled() failed!"); }; @@ -392,6 +398,7 @@ napi_value JsKVStore::EnableSync(napi_env env, napi_callback_info info) */ napi_value JsKVStore::SetSyncRange(napi_env env, napi_callback_info info) { + ZLOGD("in"); struct SyncRangeContext : public ContextBase { std::vector localLabels; std::vector remoteSupportLabels; @@ -410,7 +417,7 @@ napi_value JsKVStore::SetSyncRange(napi_env env, napi_callback_info info) auto execute = [ctxt]() { auto& kvStore = reinterpret_cast(ctxt->native)->kvStore_; Status status = kvStore->SetCapabilityRange(ctxt->localLabels, ctxt->remoteSupportLabels); - ZLOGD("kvStore->SetCapabilityRange return %{public}d", status); + ZLOGD("kvStore->SetCapabilityRange return status=%{public}d", status); ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; CHECK_STATUS_RETURN_VOID(ctxt, "kvStore->SetCapabilityRange() failed!"); }; @@ -437,7 +444,7 @@ void JsKVStore::OnDataChange(napi_env env, size_t argc, napi_value* argv, std::s CHECK_STATUS_RETURN_VOID(ctxt, "napi_typeof failed!"); CHECK_ARGS_RETURN_VOID(ctxt, valueType == napi_function, "invalid arg[2], i.e. invalid callback"); - ZLOGI("subscribe data change type %{public}d", type); + ZLOGI("subscribe data change type=%{public}d", type); auto proxy = reinterpret_cast(ctxt->native); std::lock_guard lck(proxy->listMutex_); for (auto& it : proxy->dataObserver_[type]) { @@ -558,6 +565,7 @@ void JsKVStore::OffSyncComplete(napi_env env, size_t argc, napi_value* argv, std */ napi_status JsKVStore::RegisterSyncCallback(std::shared_ptr callback) { + ZLOGD("in"); Status status = kvStore_->RegisterSyncCallback(callback); if (status != Status::SUCCESS) { callback->Clear(); @@ -572,6 +580,7 @@ napi_status JsKVStore::UnRegisterSyncCallback() { Status status = kvStore_->UnRegisterSyncCallback(); if (status != Status::SUCCESS) { + ZLOGE("unregister SyncCallback error status=%d", status); return napi_generic_failure; } std::lock_guard lck(listMutex_); @@ -586,7 +595,7 @@ napi_status JsKVStore::Subscribe(uint8_t type, std::shared_ptr obs { auto subscribeType = ToSubscribeType(type); Status status = kvStore_->SubscribeKvStore(subscribeType, observer); - ZLOGD("kvStore_->SubscribeKvStore(%{public}d) return %{public}d", type, status); + ZLOGD("kvStore_->SubscribeKvStore type=%{public}d, return status=%{public}d", type, status); if (status != Status::SUCCESS) { observer->Clear(); return napi_generic_failure; @@ -599,7 +608,7 @@ napi_status JsKVStore::UnSubscribe(uint8_t type, std::shared_ptr o { auto subscribeType = ToSubscribeType(type); Status status = kvStore_->UnSubscribeKvStore(subscribeType, observer); - ZLOGD("kvStore_->UnSubscribeKvStore(%{public}d) return %{public}d", type, status); + ZLOGD("kvStore_->UnSubscribeKvStore type=%{public}d, return status=%{public}d", type, status); if (status == Status::SUCCESS) { observer->Clear(); return napi_ok; @@ -614,7 +623,7 @@ void JsKVStore::SetUvQueue(std::shared_ptr uvQueue) void JsKVStore::DataObserver::OnChange(const ChangeNotification& notification) { - ZLOGD("data change insert:%{public}zu, update:%{public}zu, delete:%{public}zu", + ZLOGD("data change insert=%{public}zu, update=%{public}zu, delete=%{public}zu", notification.GetInsertEntries().size(), notification.GetUpdateEntries().size(), notification.GetDeleteEntries().size()); KvStoreObserver::OnChange(notification); diff --git a/frameworks/jskitsimpl/distributeddata/src/js_kv_store_resultset.cpp b/frameworks/jskitsimpl/distributeddata/src/js_kv_store_resultset.cpp index 04467b0ed99839927cf1357d28b0380c6c63ad90..780fecd04cb70ffbf67c58948318bb5b955ac22f 100644 --- a/frameworks/jskitsimpl/distributeddata/src/js_kv_store_resultset.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/js_kv_store_resultset.cpp @@ -33,6 +33,7 @@ std::shared_ptr& JsKVStoreResultSet::GetNative() napi_value JsKVStoreResultSet::Constructor(napi_env env) { + ZLOGD("KVManager::Constructor"); const napi_property_descriptor properties[] = { DECLARE_NAPI_FUNCTION("getCount", JsKVStoreResultSet::GetCount), DECLARE_NAPI_FUNCTION("getPosition", JsKVStoreResultSet::GetPosition), @@ -188,7 +189,7 @@ napi_value JsKVStoreResultSet::MoveToPosition(napi_env env, napi_callback_info i }; ctxt->GetCbInfoSync(env, info, input); NAPI_ASSERT(env, ctxt->status == napi_ok, "invalid arguments!"); - ZLOGD("KVStoreResultSet::MoveToPosition(%{public}d)", position); + ZLOGD("KVStoreResultSet::MoveToPosition position=%{public}d", position); auto& resultSet = reinterpret_cast(ctxt->native)->resultSet_; bool isMoved = resultSet->MoveToPosition(position); diff --git a/frameworks/jskitsimpl/distributeddata/src/js_query.cpp b/frameworks/jskitsimpl/distributeddata/src/js_query.cpp index feda047779ab26ffbfb4aef87088f9814646e4e0..a9c5ff7e3b828e2b85e37cad998b64e61e2674a2 100644 --- a/frameworks/jskitsimpl/distributeddata/src/js_query.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/js_query.cpp @@ -67,6 +67,7 @@ napi_value JsQuery::Constructor(napi_env env) */ napi_value JsQuery::New(napi_env env, napi_callback_info info) { + ZLOGD("Query::New()"); auto ctxt = std::make_shared(); ctxt->GetCbInfoSync(env, info); NAPI_ASSERT(env, ctxt->status == napi_ok, "invalid arguments!"); @@ -539,6 +540,7 @@ napi_value JsQuery::OrderByDesc(napi_env env, napi_callback_info info) napi_value JsQuery::Limit(napi_env env, napi_callback_info info) { + ZLOGD("Query::Limit()"); struct LimitContext : public ContextBase { int number; int offset; @@ -603,6 +605,7 @@ napi_value JsQuery::EndGroup(napi_env env, napi_callback_info info) napi_value JsQuery::PrefixKey(napi_env env, napi_callback_info info) { + ZLOGD("Query::PrefixKey()"); std::string prefix; auto ctxt = std::make_shared(); auto input = [env, ctxt, &prefix](size_t argc, napi_value* argv) { @@ -621,6 +624,7 @@ napi_value JsQuery::PrefixKey(napi_env env, napi_callback_info info) napi_value JsQuery::SetSuggestIndex(napi_env env, napi_callback_info info) { + ZLOGD("Query::SetSuggestIndex()"); std::string suggestIndex; auto ctxt = std::make_shared(); auto input = [env, ctxt, &suggestIndex](size_t argc, napi_value* argv) { @@ -639,6 +643,7 @@ napi_value JsQuery::SetSuggestIndex(napi_env env, napi_callback_info info) napi_value JsQuery::DeviceId(napi_env env, napi_callback_info info) { + ZLOGD("Query::DeviceId()"); std::string deviceId; auto ctxt = std::make_shared(); auto input = [env, ctxt, &deviceId](size_t argc, napi_value* argv) { @@ -658,6 +663,7 @@ napi_value JsQuery::DeviceId(napi_env env, napi_callback_info info) // getSqlLike():string napi_value JsQuery::GetSqlLike(napi_env env, napi_callback_info info) { + ZLOGD("Query::GetSqlLike()"); auto ctxt = std::make_shared(); ctxt->GetCbInfoSync(env, info); NAPI_ASSERT(env, ctxt->status == napi_ok, "invalid arguments!"); diff --git a/frameworks/jskitsimpl/distributeddata/src/js_schema.cpp b/frameworks/jskitsimpl/distributeddata/src/js_schema.cpp index 2be1e27167099437859be5d9eefe62105a9af669..76af3e11d847122fa72aa6def741658d705f66cc 100644 --- a/frameworks/jskitsimpl/distributeddata/src/js_schema.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/js_schema.cpp @@ -87,6 +87,7 @@ napi_status JsSchema::ToJson(napi_env env, napi_value inner, JsSchema*& out) JsSchema* JsSchema::GetSchema(napi_env env, napi_callback_info info, std::shared_ptr& ctxt) { + ZLOGD("Schema::GetSchema"); ctxt->GetCbInfoSync(env, info); NAPI_ASSERT(env, ctxt->status == napi_ok, "invalid arguments!"); return reinterpret_cast(ctxt->native); @@ -95,6 +96,7 @@ JsSchema* JsSchema::GetSchema(napi_env env, napi_callback_info info, std::shared template napi_value JsSchema::GetContextValue(napi_env env, std::shared_ptr& ctxt, T& value) { + ZLOGD("Schema::GetContextValue"); JSUtil::SetValue(env, value, ctxt->output); return ctxt->output; } @@ -154,6 +156,7 @@ napi_value JsSchema::GetMode(napi_env env, napi_callback_info info) napi_value JsSchema::SetMode(napi_env env, napi_callback_info info) { + ZLOGD("Schema::SetMode"); auto ctxt = std::make_shared(); uint32_t mode = false; auto input = [env, ctxt, &mode](size_t argc, napi_value* argv) { @@ -181,6 +184,7 @@ napi_value JsSchema::GetSkip(napi_env env, napi_callback_info info) napi_value JsSchema::SetSkip(napi_env env, napi_callback_info info) { + ZLOGD("Schema::SetSkip"); auto ctxt = std::make_shared(); uint32_t skip = false; auto input = [env, ctxt, &skip](size_t argc, napi_value* argv) { @@ -208,6 +212,7 @@ napi_value JsSchema::GetIndexes(napi_env env, napi_callback_info info) napi_value JsSchema::SetIndexes(napi_env env, napi_callback_info info) { + ZLOGD("Schema::SetIndexes"); auto ctxt = std::make_shared(); std::vector indexes; auto input = [env, ctxt, &indexes](size_t argc, napi_value* argv) { diff --git a/frameworks/jskitsimpl/distributeddata/src/js_single_kv_store.cpp b/frameworks/jskitsimpl/distributeddata/src/js_single_kv_store.cpp index 99babeb6c62d90e6a8ef26017247cb72077977ff..12f13c709b2b8b42407d56f497ab5860eee68e9a 100644 --- a/frameworks/jskitsimpl/distributeddata/src/js_single_kv_store.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/js_single_kv_store.cpp @@ -31,6 +31,7 @@ JsSingleKVStore::JsSingleKVStore(const std::string& storeId) napi_value JsSingleKVStore::Constructor(napi_env env) { + ZLOGD("JsSingleKVStore::Constructor"); const napi_property_descriptor properties[] = { DECLARE_NAPI_FUNCTION("put", JsKVStore::Put), DECLARE_NAPI_FUNCTION("delete", JsKVStore::Delete), @@ -162,11 +163,11 @@ napi_value JsSingleKVStore::GetEntries(napi_env env, napi_callback_info info) if (ctxt->va.type == ArgsType::KEYPREFIX) { OHOS::DistributedKv::Key keyPrefix(ctxt->va.keyPrefix); status = kvStore->GetEntries(keyPrefix, ctxt->entries); - ZLOGD("kvStore->GetEntries() return %{public}d", status); + ZLOGD("kvStore->GetEntries() return status=%{public}d", status); } else if (ctxt->va.type == ArgsType::QUERY) { auto query = ctxt->va.query->GetNative(); status = kvStore->GetEntriesWithQuery(query.ToString(), ctxt->entries); - ZLOGD("kvStore->GetEntriesWithQuery() return %{public}d", status); + ZLOGD("kvStore->GetEntriesWithQuery() return status=%{public}d", status); } ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; CHECK_STATUS_RETURN_VOID(ctxt, "kvStore->GetEntries() failed"); @@ -214,11 +215,11 @@ napi_value JsSingleKVStore::GetResultSet(napi_env env, napi_callback_info info) if (ctxt->va.type == ArgsType::KEYPREFIX) { OHOS::DistributedKv::Key keyPrefix(ctxt->va.keyPrefix); status = kvStore->GetResultSet(keyPrefix, kvResultSet); - ZLOGD("kvStore->GetEntries() return %{public}d", status); + ZLOGD("kvStore->GetEntries() return status=%{public}d", status); } else if (ctxt->va.type == ArgsType::QUERY) { auto query = ctxt->va.query->GetNative(); status = kvStore->GetResultSetWithQuery(query.ToString(), kvResultSet); - ZLOGD("kvStore->GetEntriesWithQuery() return %{public}d", status); + ZLOGD("kvStore->GetEntriesWithQuery() return status=%{public}d", status); } ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; CHECK_STATUS_RETURN_VOID(ctxt, "kvStore->GetResultSet() failed!"); @@ -259,7 +260,7 @@ napi_value JsSingleKVStore::CloseResultSet(napi_env env, napi_callback_info info auto execute = [ctxt]() { auto& kvStore = reinterpret_cast(ctxt->native)->GetNative(); Status status = kvStore->CloseResultSet(ctxt->resultSet->GetNative()); - ZLOGD("kvStore->CloseResultSet return %{public}d", status); + ZLOGD("kvStore->CloseResultSet return status=%{public}d", status); ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; CHECK_STATUS_RETURN_VOID(ctxt, "kvStore->CloseResultSet failed!"); }; @@ -293,7 +294,7 @@ napi_value JsSingleKVStore::GetResultSize(napi_env env, napi_callback_info info) auto& kvStore = reinterpret_cast(ctxt->native)->GetNative(); auto query = ctxt->query->GetNative(); Status status = kvStore->GetCountWithQuery(query.ToString(), ctxt->resultSize); - ZLOGD("kvStore->GetCountWithQuery() return %{public}d", status); + ZLOGD("kvStore->GetCountWithQuery() return status=%{public}d", status); ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; CHECK_STATUS_RETURN_VOID(ctxt, "kvStore->GetCountWithQuery() failed!"); }; @@ -327,7 +328,7 @@ napi_value JsSingleKVStore::RemoveDeviceData(napi_env env, napi_callback_info in auto execute = [ctxt]() { auto& kvStore = reinterpret_cast(ctxt->native)->GetNative(); Status status = kvStore->RemoveDeviceData(ctxt->deviceId); - ZLOGD("kvStore->RemoveDeviceData return %{public}d", status); + ZLOGD("kvStore->RemoveDeviceData return status=%{public}d", status); ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; CHECK_STATUS_RETURN_VOID(ctxt, "kvStore->RemoveDeviceData failed!"); }; @@ -362,12 +363,12 @@ napi_value JsSingleKVStore::Sync(napi_env env, napi_callback_info info) }; ctxt->GetCbInfoSync(env, info, input); NAPI_ASSERT(env, ctxt->status == napi_ok, "invalid arguments!"); - ZLOGD("sync deviceIdList.size=%{public}d, mode:%{public}u, allowedDelayMs:%{public}u", + ZLOGD("sync deviceIdList.size=%{public}d, mode=%{public}u, allowedDelayMs=%{public}u", (int)ctxt->deviceIdList.size(), ctxt->mode, ctxt->allowedDelayMs); auto& kvStore = reinterpret_cast(ctxt->native)->GetNative(); Status status = kvStore->Sync(ctxt->deviceIdList, static_cast(ctxt->mode), ctxt->allowedDelayMs); - ZLOGD("kvStore->Sync return %{public}d!", status); + ZLOGD("kvStore->Sync return status=%{public}d!", status); NAPI_ASSERT(env, status == Status::SUCCESS, "kvStore->Sync() failed!"); return nullptr; } @@ -396,7 +397,7 @@ napi_value JsSingleKVStore::SetSyncParam(napi_env env, napi_callback_info info) auto& kvStore = reinterpret_cast(ctxt->native)->GetNative(); KvSyncParam syncParam { ctxt->allowedDelayMs }; Status status = kvStore->SetSyncParam(syncParam); - ZLOGD("kvStore->SetSyncParam return %{public}d", status); + ZLOGD("kvStore->SetSyncParam return status=%{public}d", status); ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; CHECK_STATUS_RETURN_VOID(ctxt, "output failed!"); }; @@ -420,7 +421,7 @@ napi_value JsSingleKVStore::GetSecurityLevel(napi_env env, napi_callback_info in auto execute = [ctxt]() { auto& kvStore = reinterpret_cast(ctxt->native)->GetNative(); Status status = kvStore->GetSecurityLevel(ctxt->securityLevel); - ZLOGD("kvStore->GetSecurityLevel return %{public}d", status); + ZLOGD("kvStore->GetSecurityLevel return status=%{public}d", status); ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; CHECK_STATUS_RETURN_VOID(ctxt, "GetSecurityLevel failed!"); }; diff --git a/frameworks/jskitsimpl/distributeddata/src/js_util.cpp b/frameworks/jskitsimpl/distributeddata/src/js_util.cpp index 0f8842775a624b4197a89b17d7262b413615c027..21acce732a468f4147e1178839242ce7c098ca8e 100644 --- a/frameworks/jskitsimpl/distributeddata/src/js_util.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/js_util.cpp @@ -94,7 +94,7 @@ napi_status JSUtil::GetValue(napi_env env, napi_value in, std::string& out) if (maxLen <= 0) { return status; } - ZLOGD("napi_value -> std::string get length %{public}d", (int)maxLen); + ZLOGD("napi_value -> std::string get length=%{public}d", (int)maxLen); char* buf = new (std::nothrow) char[maxLen + STR_TAIL_LENGTH]; if (buf != nullptr) { size_t len = 0; @@ -164,7 +164,7 @@ JSUtil::KvStoreVariant JSUtil::Blob2VariantValue(const DistributedKv::Blob& blob } // number 1 means: skip the first byte, byte[0] is real data type. std::vector real(data.begin() + 1, data.end()); - ZLOGD("Blob::type %{public}d size=%{public}d", static_cast(data[0]), static_cast(real.size())); + ZLOGD("Blob::type=%{public}d size=%{public}d", static_cast(data[0]), static_cast(real.size())); if (data[0] == JSUtil::INTEGER) { uint32_t tmp4int = be32toh(*reinterpret_cast(&(real[0]))); return JSUtil::KvStoreVariant(*reinterpret_cast(&tmp4int)); @@ -975,6 +975,7 @@ napi_ref JSUtil::NewWithRef(napi_env env, size_t argc, napi_value* argv, void** napi_status JSUtil::Unwrap(napi_env env, napi_value in, void** out, napi_value constructor) { + ZLOGD("JSUtil::Unwrap"); if (constructor != nullptr) { bool isInstance = false; napi_instanceof(env, in, constructor, &isInstance); diff --git a/frameworks/jskitsimpl/distributeddata/src/napi_queue.cpp b/frameworks/jskitsimpl/distributeddata/src/napi_queue.cpp index f225e70b76d78a6abba61958c8a01ed6793b6b43..5f9db8286d8e58fa3539216835e800eadcc80a1c 100644 --- a/frameworks/jskitsimpl/distributeddata/src/napi_queue.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/napi_queue.cpp @@ -119,10 +119,12 @@ void NapiQueue::GenerateOutput(ContextBase* ctxt) if (ctxt->status == napi_ok) { napi_get_undefined(ctxt->env, &result[RESULT_ERROR]); if (ctxt->output == nullptr) { + ZLOGD("ctxt->output is nullptr"); napi_get_undefined(ctxt->env, &ctxt->output); } result[RESULT_DATA] = ctxt->output; } else { + ZLOGD("ctxt->status != napi_ok"); napi_value message = nullptr; napi_create_string_utf8(ctxt->env, ctxt->error.c_str(), NAPI_AUTO_LENGTH, &message); napi_create_error(ctxt->env, nullptr, message, &result[RESULT_ERROR]); diff --git a/services/distributeddataservice/adapter/autils/src/directory_utils.cpp b/services/distributeddataservice/adapter/autils/src/directory_utils.cpp index b126261064e9204ab9454c9263af7bc1adaf5d12..6ef35fb40769f3a0e22f1f8493a9266fac95703f 100644 --- a/services/distributeddataservice/adapter/autils/src/directory_utils.cpp +++ b/services/distributeddataservice/adapter/autils/src/directory_utils.cpp @@ -31,12 +31,14 @@ bool DirectoryUtils::ChangeModeFileOnly(const std::string &path, const mode_t &m bool ret = true; DIR *dir = opendir(path.c_str()); if (dir == nullptr) { + ZLOGE("open dir failed!"); return false; } while (true) { struct dirent *ptr = readdir(dir); if (ptr == nullptr) { + ZLOGE("read dir failed!"); break; } @@ -53,10 +55,11 @@ 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 = %{private}s to mode = %{public}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 failed, path = %{private}s, mode = %{public}d .", + subPath.c_str(), mode); return false; } } @@ -73,12 +76,14 @@ bool DirectoryUtils::ChangeModeDirOnly(const std::string &path, const mode_t &mo bool ret = true; DIR *dir = opendir(path.c_str()); if (dir == nullptr) { + ZLOGE("open dir failed!"); return false; } while (true) { struct dirent *ptr = readdir(dir); if (ptr == nullptr) { + ZLOGE("read dir failed!"); break; } @@ -95,10 +100,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 = %{private}s to mode = %{public}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 failed, dir= %{private}s, mode = %{public}d", subPath.c_str(), mode); return false; } } 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..727b6cc2a6a449394dd36a7a8d2d31e7d9aa3d8a 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); + ZLOGE("Input is invalid, maxSize = %{public}d, current size = %{public}d", DataBuffer::MAX_TRANSFER_SIZE, size); return Status::ERROR; } - ZLOGD("pipeInfo:%s ,size:%d", pipeInfo.pipeId.c_str(), size); + ZLOGD("pipeInfo = %{public}s ,size = %{public}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 = %{public}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 not found, id = %{public}s", 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, id = %{public}s ret = %{public}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 = %{public}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 not found, id=%{public}s. 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 not found, id = %{public}s", 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 5b3712e7cb0a0555008b38200ddb94ab3785744f..4d4b7605561bed59faea992d8bb5c39c8031bbb4 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; } @@ -237,7 +237,7 @@ DBStatus ProcessCommunicatorImpl::CheckAndGetDataHeadInfo( ZLOGW("no valid user"); return DBStatus::NO_PERMISSION; } - ZLOGD("ok, result:%{public}zu, user:%{public}s", users.size(), users.front().c_str()); + ZLOGD("ok, result = %{public}zu, 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 5e4e2ff04d540f774c2ca785e36c61a0e7afc24b..704741d3ce905db79d6db35b4c856d3dc5afbef3 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); } @@ -136,7 +136,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); } } @@ -146,20 +146,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(); } @@ -210,7 +210,6 @@ void SoftBusAdapter::NotifyAll(const DeviceInfo &deviceInfo, const DeviceChangeT } } ZLOGD("high"); - ZLOGD("[Notify] to DB from: %{public}s, type:%{public}d", ToBeAnonymous(deviceInfo.uuid).c_str(), type); UpdateRelationship(deviceInfo, type); for (const auto &device : listeners) { if (device == nullptr) { @@ -256,7 +255,7 @@ std::vector SoftBusAdapter::GetRemoteDevices() 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)); @@ -293,7 +292,7 @@ DeviceInfo SoftBusAdapter::GetLocalDevice() } std::string uuid = GetUuidByNodeId(std::string(info.networkId)); std::string udid = GetUdidByNodeId(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, udid, info.networkId, info.deviceName, info.deviceTypeId }; return localInfo_; @@ -305,7 +304,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); @@ -317,7 +316,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); @@ -332,7 +331,7 @@ DeviceInfo SoftBusAdapter::GetLocalBasicInfo() const ZLOGE("GetLocalNodeDeviceInfo error"); return {}; } - 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); std::string uuid = GetUuidByNodeId(std::string(info.networkId)); std::string udid = GetUdidByNodeId(std::string(info.networkId)); @@ -460,7 +459,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; } @@ -473,7 +472,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; } @@ -482,25 +481,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; @@ -540,7 +539,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_); @@ -555,17 +554,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(), flag); + ZLOGI("pipeInfo:pipeId = %{public}s, flag:=%{public}d", pipeInfo.pipeId.c_str(), static_cast(flag)); flag_ = flag; } @@ -600,7 +599,7 @@ void SoftBusAdapter::NotifyDataListeners(const uint8_t *ptr, int size, const std 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 = GetDeviceInfo(deviceId); it->second->OnMessage(deviceInfo, ptr, size, pipeInfo); @@ -608,7 +607,7 @@ void SoftBusAdapter::NotifyDataListeners(const uint8_t *ptr, int size, const std 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) @@ -619,33 +618,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) { @@ -658,7 +657,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] = ""; @@ -666,21 +665,21 @@ 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)); if (ret != SOFTBUS_OK) { - ZLOGW("get my peer session name failed."); + 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("[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) { @@ -700,16 +699,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), ""}); } @@ -724,16 +723,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 e2bfe49ae2d03a859a8112e18dd50e67c75bf8b6..ddef609f6335745e4438c1721b13f29cf0309bae 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 @@ -37,7 +37,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 = %{public}s", info.deviceName.c_str(), ptr); } class AppDeviceStatusChangeListenerImpl : public AppDeviceChangeListener { @@ -50,7 +50,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() @@ -92,7 +92,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 = %{public}d", static_cast(secRegister)); EXPECT_EQ(Status::ERROR, secRegister); 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 9e172f3abad3d8f1abe27c375b915bd183390609..a759d39329c66b53e483aac7e255555ad6792521 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 DistributedKv diff --git a/services/distributeddataservice/app/src/kvstore_account_observer.cpp b/services/distributeddataservice/app/src/kvstore_account_observer.cpp index f8258225511affad7909ed7dcbb73977d1b0fe73..6abd9f961188b2373e8728c3f7f5d1395a8a43db 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 = %{public}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 = %{public}d, end.", eventInfo.status); } } // namespace DistributedKv } // namespace OHOS diff --git a/services/distributeddataservice/app/src/kvstore_app_accessor.cpp b/services/distributeddataservice/app/src/kvstore_app_accessor.cpp index 993a197cd17bce1b032268c921a8d4895874f15b..4c7321c90efc543d7bb92373dd7dbde367df69a9 100644 --- a/services/distributeddataservice/app/src/kvstore_app_accessor.cpp +++ b/services/distributeddataservice/app/src/kvstore_app_accessor.cpp @@ -72,12 +72,13 @@ 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 = %{public}s is opened, bundle = %{public}s.", + appId.c_str(), kvStoreMetaData.bundleName.c_str()); } else { - ZLOGW("AppId:%s open failed.", appId.c_str()); + ZLOGW("AppId = %{public}s open failed.", appId.c_str()); } } else { - ZLOGD("AppId:%s is closed.", appId.c_str()); + ZLOGD("AppId = %{public}s is closed.", appId.c_str()); } } } // namespace OHOS::DistributedKv diff --git a/services/distributeddataservice/app/src/kvstore_app_manager.cpp b/services/distributeddataservice/app/src/kvstore_app_manager.cpp index f2e3fc5b55ec963d8db9750fbad508a8580863fc..4399e01b0782cd4d95d6371746d9c56ff8726a23 100644 --- a/services/distributeddataservice/app/src/kvstore_app_manager.cpp +++ b/services/distributeddataservice/app/src/kvstore_app_manager.cpp @@ -65,7 +65,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 = %{public}d.", static_cast(dbStatus)); switch (dbStatus) { case DistributedDB::DBStatus::INVALID_PASSWD_OR_CORRUPTED_DB: return Status::CRYPT_ERROR; @@ -98,7 +98,7 @@ Status KvStoreAppManager::GetKvStore(const Options &options, const StoreMetaData PathType type = ConvertPathType(metaData); auto *delegateManager = GetDelegateManager(type); if (delegateManager == nullptr) { - ZLOGE("delegateManagers[%d] is nullptr.", type); + ZLOGE("delegateManagers is nullptr. type = %{public}d", type); return Status::ILLEGAL_STATE; } @@ -110,13 +110,13 @@ Status KvStoreAppManager::GetKvStore(const Options &options, const StoreMetaData auto it = singleStores_[type].find(metaData.storeId); if (it != singleStores_[type].end()) { kvStore = it->second; - ZLOGI("find store in map refcount: %d.", kvStore->GetSptrRefCount()); + ZLOGI("find store in map, refcount = %{public}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 can be opened. count=%{public}d", Constant::MAX_OPEN_KVSTORES); return Status::ERROR; } @@ -165,13 +165,14 @@ Status KvStoreAppManager::GetKvStore(const Options &options, const StoreMetaData return Status::ERROR; } - ZLOGI("after emplace refcount: %d autoSync: %d", kvStore->GetSptrRefCount(), static_cast(options.autoSync)); + ZLOGI("after emplace refcount = %{public}d, autoSync = %{public}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 = %{public}d", static_cast(pragmaStatus)); } } @@ -215,7 +216,7 @@ Status KvStoreAppManager::CloseAllKvStore() return Status::STORE_NOT_OPEN; } - ZLOGI("close %zu KvStores.", GetTotalKvStoreNum()); + ZLOGI("close KvStores = %{public}zu.", GetTotalKvStoreNum()); Status status = CloseAllKvStore(PATH_DE); if (status == Status::DB_ERROR) { return status; @@ -229,7 +230,7 @@ Status KvStoreAppManager::CloseAllKvStore() Status KvStoreAppManager::DeleteKvStore(const std::string &storeId) { - ZLOGI("%s", storeId.c_str()); + ZLOGI("storeId=%{public}s", storeId.c_str()); if (!flowCtrl_.IsTokenEnough()) { ZLOGE("flow control denied"); return Status::EXCEED_MAX_ACCESS_RATE; @@ -252,16 +253,16 @@ Status KvStoreAppManager::DeleteAllKvStore() if (GetTotalKvStoreNum() == 0) { return Status::STORE_NOT_OPEN; } - ZLOGI("delete %d KvStores.", int32_t(GetTotalKvStoreNum())); + ZLOGI("delete KvStores = %{public}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 = %{public}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 = %{public}d.", static_cast(status)); return Status::DB_ERROR; } return Status::SUCCESS; @@ -341,7 +342,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 = %{public}s failed, errstr=%{public}d.", directory.c_str(), errno); return nullptr; } // change mode for directories to 0755, and for files to 0600. @@ -357,10 +358,10 @@ DistributedDB::KvStoreDelegateManager *KvStoreAppManager::GetDelegateManager(Pat } userId_ = AccountDelegate::GetInstance()->GetCurrentAccountId(); - 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_ is nullptr. type = %{public}d", type); return nullptr; } @@ -383,7 +384,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 is null. type = %{public}d", type); return Status::ILLEGAL_STATE; } @@ -398,7 +399,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 = %{public}d.", static_cast(status)); return Status::DB_ERROR; } @@ -409,16 +410,16 @@ Status KvStoreAppManager::CloseAllKvStore(PathType type) { auto *delegateManager = GetDelegateManager(type); if (delegateManager == nullptr) { - ZLOGE("delegateManager[%d] is null.", type); + ZLOGE("delegateManager type = %{public}d is null.", type); return Status::ILLEGAL_STATE; } 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 = %{public}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 = %{public}d.", static_cast(status)); return Status::DB_ERROR; } } @@ -430,7 +431,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 = %{public}d is null.", type); return Status::ILLEGAL_STATE; } std::lock_guard lg(storeMutex_); @@ -455,7 +456,7 @@ Status KvStoreAppManager::DeleteAllKvStore(PathType type) { auto *delegateManager = GetDelegateManager(type); if (delegateManager == nullptr) { - ZLOGE("delegateManager[%d] is null.", type); + ZLOGE("delegateManager type = %{public}d is null.", type); return Status::ILLEGAL_STATE; } @@ -464,14 +465,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 = %{public}d.", static_cast(status)); return Status::DB_ERROR; } - ZLOGI("close kvstore, refcount %d.", it->second->GetSptrRefCount()); + ZLOGI("close kvstore, refcount = %{public}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 = %{public}d.", static_cast(dbStatus)); return Status::DB_ERROR; } } diff --git a/services/distributeddataservice/app/src/kvstore_data_service.cpp b/services/distributeddataservice/app/src/kvstore_data_service.cpp index 20b8981446abb32319c7c21bde8a50afdf55dedb..8a93b87b3681b42a0c483f64d1fc57440a1298e6 100644 --- a/services/distributeddataservice/app/src/kvstore_data_service.cpp +++ b/services/distributeddataservice/app/src/kvstore_data_service.cpp @@ -104,13 +104,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(); @@ -123,7 +123,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++; @@ -433,7 +433,7 @@ Status KvStoreDataService::RecoverKvStore( ZLOGE("RecoverSingleKvStore Import failed."); return Status::RECOVER_FAILED; } - ZLOGD("RecoverSingleKvStore Import success."); + ZLOGD("RecoverSingleKvStore Import successful."); return Status::RECOVER_SUCCESS; } @@ -579,7 +579,7 @@ Status KvStoreDataService::DeleteKvStore(const AppId &appId, const StoreId &stor Status KvStoreDataService::DeleteAllKvStore(const AppId &appId) { DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); - ZLOGI("%s", appId.appId.c_str()); + ZLOGI("%{public}s", appId.appId.c_str()); if (!appId.IsValid()) { ZLOGE("invalid bundleName."); return Status::INVALID_ARGUMENT; @@ -603,14 +603,14 @@ Status KvStoreDataService::DeleteAllKvStore(const AppId &appId) }); if (statusTmp != Status::SUCCESS) { - ZLOGE("%s, error: %d ", appId.appId.c_str(), static_cast(statusTmp)); + ZLOGE("appId = %{public}s, error = %{public}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 = %{public}s, error = %{public}d ", appId.appId.c_str(), static_cast(statusTmp)); return statusTmp; } } @@ -738,7 +738,7 @@ void KvStoreDataService::StartService() std::string backupPath = BackupHandler::GetBackupPath( AccountDelegate::GetInstance()->GetDeviceAccountIdByUID(getuid()), KvStoreAppManager::PATH_DE); - ZLOGI("backupPath is : %s ", backupPath.c_str()); + ZLOGI("backupPath = %{public}s ", backupPath.c_str()); if (!ForceCreateDirectory(backupPath)) { ZLOGE("backup create directory failed"); } @@ -755,7 +755,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=%{public}s, stid=%{public}s.", appId.c_str(), storeId.c_str()); return CheckPermissions(userId, appId, storeId, deviceId, flag); }; auto dbStatus = KvStoreDelegateManager::SetPermissionCheckCallback(permissionCheckCallback); @@ -777,7 +777,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( @@ -788,7 +788,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"); @@ -798,7 +798,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 }); } @@ -884,7 +884,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); @@ -934,7 +934,7 @@ bool KvStoreDataService::CheckPermissions(const std::string &userId, const std:: } bool ret = PermissionValidator::GetInstance().CheckSyncPermission(metaData.tokenId); - ZLOGD("checking sync permission ret:%{public}d.", ret); + ZLOGD("checking sync permission ret=%{public}d.", ret); return ret; } @@ -1043,7 +1043,7 @@ Status KvStoreDataService::DeleteKvStoreOnly(const StoreMetaData &metaData) 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: { @@ -1068,14 +1068,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) @@ -1092,14 +1092,14 @@ Status KvStoreDataService::GetRemoteDevices(std::vector &deviceInfoL DeviceInfo deviceInfo = { device.networkId, device.deviceName, std::to_string(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 = %{public}d", ret); security_ = std::make_shared(); if (security_ == nullptr) { ZLOGD("Security is nullptr."); @@ -1107,12 +1107,12 @@ 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 = %{public}d.", static_cast(dbStatus)); auto status = AppDistributedKv::CommunicationProvider::GetInstance().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 = %{public}d", static_cast(status)); } } @@ -1132,7 +1132,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; } diff --git a/services/distributeddataservice/app/src/kvstore_meta_manager.cpp b/services/distributeddataservice/app/src/kvstore_meta_manager.cpp index d90056daad5ac8dc799c7b8fc7f23456f8d3aa22..10de2ae860aecd787dc70d9597f48594c3cfc62a 100644 --- a/services/distributeddataservice/app/src/kvstore_meta_manager.cpp +++ b/services/distributeddataservice/app/src/kvstore_meta_manager.cpp @@ -67,7 +67,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 = %{public}d", static_cast(result)); } }), metaDBDirectory_("/data/service/el1/public/database/distributeddata/meta"), @@ -101,7 +101,7 @@ void KvStoreMetaManager::InitMetaListener() ZLOGW("register failed."); return; } - ZLOGI("register meta device change success."); + ZLOGI("register meta device change successful."); SubscribeMetaKvStore(); } @@ -196,7 +196,7 @@ KvStoreMetaManager::NbDelegate KvStoreMetaManager::CreateMetaKvStore() }); if (dbStatusTmp != DistributedDB::DBStatus::OK) { - ZLOGE("GetKvStore return error status: %{public}d", static_cast(dbStatusTmp)); + ZLOGE("GetKvStore return error status = %{public}d", static_cast(dbStatusTmp)); return nullptr; } auto release = [this](DistributedDB::KvStoreNbDelegate *delegate) { @@ -207,7 +207,7 @@ KvStoreMetaManager::NbDelegate KvStoreMetaManager::CreateMetaKvStore() auto result = kvStoreDelegateManager_.CloseKvStore(delegate); if (result != DistributedDB::DBStatus::OK) { - ZLOGE("CloseMetaKvStore return error status: %{public}d", static_cast(result)); + ZLOGE("CloseMetaKvStore return error status = %{public}d", static_cast(result)); } }; return NbDelegate(kvStoreNbDelegatePtr, release); @@ -276,7 +276,7 @@ std::string KvStoreMetaManager::GetSecretSingleKeyFile(const std::string &userId std::string hashedStoreId; DistributedDB::DBStatus result = DistributedDB::KvStoreDelegateManager::GetDatabaseDir(storeId, hashedStoreId); if (DistributedDB::OK != result) { - ZLOGE("get data base directory by kvstore store id failed, result = %d.", result); + ZLOGE("get data base directory by kvstore store id failed, result = %{public}d.", result); return ""; } std::string miscPath = (pathType == KvStoreAppManager::PATH_DE) ? Constant::ROOT_PATH_DE : Constant::ROOT_PATH_CE; @@ -330,7 +330,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; } @@ -342,7 +342,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; } @@ -357,21 +357,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; } @@ -389,7 +389,7 @@ Status KvStoreMetaManager::GenerateRootKey() DistributedDB::DBStatus::OK) { return Status::ERROR; } - ZLOGI("GenerateRootKey Succeed."); + ZLOGI("GenerateRootKey Successful."); return Status::SUCCESS; } @@ -424,7 +424,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[] = { @@ -489,21 +489,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; } @@ -535,7 +535,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 = %{public}d", static_cast(dbStatus)); return Status::DB_ERROR; } else { ZLOGD("normal end"); @@ -582,19 +582,19 @@ 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 = %{public}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 = %{public}d", static_cast(dbStatus)); status = Status::DB_ERROR; } for (int32_t pathType = KvStoreAppManager::PATH_DE; pathType < KvStoreAppManager::PATH_TYPE_MAX; ++pathType) { std::string keyFile = GetSecretSingleKeyFile(userId, bundleName, storeId, pathType); if (!RemoveFile(keyFile)) { - ZLOGW("remove secretKeyFile Single fail."); + ZLOGW("remove secretKeyFile Single failed."); status = Status::DB_ERROR; } } @@ -824,7 +824,7 @@ void KvStoreMetaManager::SyncMeta() } if (devs.empty()) { - ZLOGW("meta db sync fail, devices is empty."); + ZLOGW("meta db sync failed, devices is empty."); return; } @@ -840,7 +840,7 @@ void KvStoreMetaManager::SyncMeta() }; auto dbStatus = metaDelegate->Sync(devs, DistributedDB::SyncMode::SYNC_MODE_PUSH_PULL, onComplete); if (dbStatus != DistributedDB::OK) { - ZLOGW("meta db sync error %d.", dbStatus); + ZLOGW("meta db sync error, status=%{public}d.", dbStatus); } } @@ -855,7 +855,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); } } @@ -896,7 +896,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; } @@ -907,19 +907,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 = %{public}s.", key.c_str()); auto metaDelegate = GetMetaKvStore(); if (metaDelegate == nullptr) { ZLOGW("get delegate error."); @@ -929,7 +929,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 = %{public}d.", dbStatus); return Status::DB_ERROR; } @@ -990,7 +990,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); } @@ -1033,7 +1033,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=%{public}s, ret=%{public}d.", dbPrefixKey.c_str(), static_cast(status)); return Status::ERROR; } } @@ -1043,12 +1043,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; } @@ -1062,7 +1062,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; @@ -1151,7 +1151,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 = %{public}s.", name.c_str()); return val; } @@ -1185,13 +1185,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 = %{public}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 = %{public}s", jsonStr.c_str()); auto metaObj = Serializable::ToJson(jsonStr); MetaData metaData {0}; metaData.kvStoreType = MetaData::GetKvStoreType(metaObj); @@ -1237,13 +1237,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 = %{public}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 = %{public}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_sync_manager.cpp b/services/distributeddataservice/app/src/kvstore_sync_manager.cpp index 746477abef4a39ea16c029f046b1cc3d87fd0b08..52514101c584fbcbf68fd4d936a36ae08b4a2474 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 = %{public}u delay = %{public}u count = %{public}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 = %{public}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 = %{public}u syncing ops by timeout", count); } } void KvStoreSyncManager::Schedule(const TimePoint &time) { - ZLOGD("timeout %lld", time.time_since_epoch().count()); + ZLOGD("timeout count = %{public}lld", time.time_since_epoch().count()); std::list syncOps; bool delaySchedule = GetTimeoutSyncOps(time, syncOps); diff --git a/services/distributeddataservice/app/src/query_helper.cpp b/services/distributeddataservice/app/src/query_helper.cpp index b197b61efd19869aef0900bab788bfaf07c33ff9..a2dd2f2864fb37509928ae7a34aefe5155a271cc 100644 --- a/services/distributeddataservice/app/src/query_helper.cpp +++ b/services/distributeddataservice/app/src/query_helper.cpp @@ -35,7 +35,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.empty()) { ZLOGI("Query string is empty."); @@ -549,9 +549,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=%{public}zu", deviceId_.length()); deviceId_ = AppDistributedKv::CommunicationProvider::GetInstance().GetUuidByNodeId(deviceId_); // convert to UUId - ZLOGI("query converted devId string length:%zu", deviceId_.length()); + ZLOGI("query converted devId string length=%{public}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 6453bed0431e90ac12119cec8dc1312e8091c3e7..ad060b3535af532bcf03186565a6a708f5baec36 100644 --- a/services/distributeddataservice/app/src/security/security.cpp +++ b/services/distributeddataservice/app/src/security/security.cpp @@ -91,7 +91,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 = %{public}d", option.securityLabel); Sensitive sensitive = GetSensitiveByUuid(deviceId); return (sensitive >= option); } @@ -143,7 +143,7 @@ void Security::OnDeviceChanged(const AppDistributedKv::DeviceInfo &info, Sensitive sensitive = GetSensitiveByUuid(info.uuid); ZLOGD("device is online, deviceId:%{public}s", Anonymous::Change(info.uuid).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.uuid); ZLOGD("device is offline, deviceId:%{public}s", Anonymous::Change(info.uuid).c_str()); @@ -168,7 +168,7 @@ Sensitive Security::GetSensitiveByUuid(const std::string &uuid) devices.push_back(network.GetLocalBasicInfo()); for (auto &device : devices) { auto deviceUuid = device.uuid; - 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; @@ -197,7 +197,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; } @@ -206,14 +206,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=%{public}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=%{public}d, datalevel=%{public}s", result, dataLevel.c_str()); return DBStatus::DB_ERROR; } @@ -240,7 +240,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..5e6773b63681196a169854c79653c4f8b4d6b4b4 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 = %{public}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 = %{public}d", Anonymous::Change(udid).c_str(), securityLevel, result); return securityLevel; } diff --git a/services/distributeddataservice/app/src/session_manager/route_head_handler_impl.cpp b/services/distributeddataservice/app/src/session_manager/route_head_handler_impl.cpp index a328ba109d38aceacbc7fb0f31802abdb9c43eb5..e71741a50bb8e1d7297a5b93e791b4dcacf498bf 100644 --- a/services/distributeddataservice/app/src/session_manager/route_head_handler_impl.cpp +++ b/services/distributeddataservice/app/src/session_manager/route_head_handler_impl.cpp @@ -57,7 +57,7 @@ void RouteHeadHandlerImpl::Init() SessionPoint localPoint { DeviceKvStoreImpl::GetLocalDeviceId(), static_cast(atoi(userId_.c_str())), appId_, storeId_ }; session_ = SessionManager::GetInstance().GetSession(localPoint, deviceId_); - ZLOGD("valid session:%{public}s", Serializable::Marshall(session_).c_str()); + ZLOGD("valid session=%{public}s", Serializable::Marshall(session_).c_str()); } DistributedDB::DBStatus RouteHeadHandlerImpl::GetHeadDataSize(uint32_t &headSize) @@ -88,7 +88,7 @@ DistributedDB::DBStatus RouteHeadHandlerImpl::GetHeadDataSize(uint32_t &headSize // align message uint width headSize = GET_ALIGNED_SIZE(expectSize, ALIGN_WIDTH); - ZLOGI("packed size:%{public}u", headSize); + ZLOGI("packed size=%{public}u", headSize); headSize_ = headSize; return DistributedDB::OK; } @@ -105,7 +105,7 @@ DistributedDB::DBStatus RouteHeadHandlerImpl::FillHeadData(uint8_t *data, uint32 return DistributedDB::OK; } auto packRet = PackData(data, headSize); - ZLOGD("pack result:%{public}d", packRet); + ZLOGD("pack result=%{public}d", packRet); return packRet ? DistributedDB::OK : DistributedDB::DB_ERROR; } @@ -183,11 +183,11 @@ bool RouteHeadHandlerImpl::ParseHeadData( ZLOGE("unpack data head failed"); return false; } - ZLOGI("unpacked size:%{public}u", headSize); + ZLOGI("unpacked size = %{public}u", headSize); // flip the local and peer ends SessionPoint local { .deviceId = session_.targetDeviceId, .appId = session_.appId }; SessionPoint peer { .deviceId = session_.sourceDeviceId, .userId = session_.sourceUserId, .appId = session_.appId }; - ZLOGI("validSession:%{public}s", Serializable::Marshall(session_).c_str()); + ZLOGI("validSession = %{public}s", Serializable::Marshall(session_).c_str()); for (const auto &item : session_.targetUserIds) { local.userId = item; if (SessionManager::GetInstance().CheckSession(local, peer)) { diff --git a/services/distributeddataservice/app/src/session_manager/session_manager.cpp b/services/distributeddataservice/app/src/session_manager/session_manager.cpp index 271c1d8cbd64032b9c60611ada646bacede540e7..a0cc9a1845df6291a0887c25af97eb7789434713 100644 --- a/services/distributeddataservice/app/src/session_manager/session_manager.cpp +++ b/services/distributeddataservice/app/src/session_manager/session_manager.cpp @@ -60,7 +60,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 userid = %{private}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 db9f3d122bd6ffaa47bd1422e68564392b0f95bf..91da38aac5199f4bdc69bb6d2251e288cd9ea5b9 100644 --- a/services/distributeddataservice/app/src/session_manager/upgrade_manager.cpp +++ b/services/distributeddataservice/app/src/session_manager/upgrade_manager.cpp @@ -108,7 +108,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); } @@ -127,7 +127,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, 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 0b691049ea3706abf3866cc7b41dfa571985751a..ee4340f98370a9bc61f2a937f7e5e1bafecf0188 100644 --- a/services/distributeddataservice/app/src/single_kvstore_impl.cpp +++ b/services/distributeddataservice/app/src/single_kvstore_impl.cpp @@ -39,7 +39,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 = %{public}d open = %{public}d", pid, ifs.good()); if (!ifs.good()) { return false; } @@ -104,10 +104,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 = %{public}d.", static_cast(status)); if (status == DistributedDB::DBStatus::INVALID_PASSWD_OR_CORRUPTED_DB) { ZLOGI("Put failed, distributeddb need recover."); @@ -180,10 +180,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 = %{public}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); @@ -214,7 +214,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 = %{public}d.", static_cast(status)); if (status == DistributedDB::DBStatus::OK) { Reporter::GetInstance()->VisitStatistic()->Report({bundleName_, __FUNCTION__}); // Value don't have other write method. @@ -334,7 +334,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; @@ -351,7 +351,7 @@ Status SingleKvStoreImpl::UnSubscribeKvStore(const SubscribeType subscribeType, return Status::SUCCESS; } - ZLOGW("failed code=%d.", static_cast(dbStatus)); + ZLOGW("failed code=%{public}d.", static_cast(dbStatus)); if (dbStatus == DistributedDB::DBStatus::NOT_FOUND) { return Status::STORE_NOT_SUBSCRIBE; } @@ -384,10 +384,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 = %{public}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 = %{public}zu status = %{public}d.", dbEntries.size(), static_cast(status)); for (auto const &dbEntry : dbEntries) { Key tmpKey(dbEntry.key); Value tmpValue(dbEntry.value); @@ -406,7 +406,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) { @@ -433,7 +433,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) { @@ -446,10 +446,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 = %{public}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 = %{public}zu status = %{public}d.", dbEntries.size(), static_cast(status)); for (auto const &dbEntry : dbEntries) { Key tmpKey(dbEntry.key); Value tmpValue(dbEntry.value); @@ -461,7 +461,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); @@ -495,7 +495,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 = %{public}d", static_cast(status)); if (status == DistributedDB::DBStatus::OK) { std::lock_guard lg(storeResultSetMutex_); sptr storeResultSet = CreateResultSet(dbResultSet, tmpKeyPrefix); @@ -526,7 +526,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) { @@ -540,7 +540,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 = %{public}d", static_cast(status)); if (status == DistributedDB::DBStatus::OK) { std::lock_guard lg(storeResultSetMutex_); sptr storeResultSet = CreateResultSet(dbResultSet, {}); @@ -601,7 +601,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) { @@ -613,7 +613,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 = %{public}d", static_cast(status)); switch (status) { case DistributedDB::DBStatus::OK: { return Status::SUCCESS; @@ -635,7 +635,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; } @@ -834,7 +834,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_); @@ -845,7 +845,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 = %{public}d", static_cast(status)); } Reporter::GetInstance()->VisitStatistic()->Report({bundleName_, __FUNCTION__}); if (status == DistributedDB::DBStatus::BUSY) { @@ -880,7 +880,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 = %{public}d", static_cast(status)); } Reporter::GetInstance()->VisitStatistic()->Report({bundleName_, __FUNCTION__}); if (status == DistributedDB::DBStatus::BUSY) { @@ -922,7 +922,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_); @@ -932,7 +932,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: %u", static_cast(status)); + ZLOGD("end data = %{public}d", static_cast(status)); } Reporter::GetInstance()->VisitStatistic()->Report({bundleName_, __FUNCTION__}); return ConvertDbStatus(status); @@ -953,7 +953,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_); @@ -963,7 +963,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: %u", static_cast(status)); + ZLOGD("end data = %{public}d", static_cast(status)); } return ConvertDbStatus(status); } @@ -1032,7 +1032,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 = %{public}d.", openCount_); std::unique_lock lock(storeNbDelegateMutex_); if (kvStoreNbDelegate_ == nullptr || kvStoreDelegateManager == nullptr) { ZLOGW("get nullptr"); @@ -1047,7 +1047,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 = %{public}d.", dbStatus); return Status::ERROR; } } @@ -1056,7 +1056,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 = %{public}d", status); return status; } resultSetPair = storeResultSetMap_.erase(resultSetPair); @@ -1067,7 +1067,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 = %{public}d.", status); return Status::ERROR; } @@ -1315,7 +1315,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; } @@ -1323,12 +1323,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: { @@ -1474,7 +1474,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; } @@ -1484,11 +1484,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 05cecccd23ffd3c18d5f8ca3968a31b325ff9810..2883d63cb98c8863f6edbde8c1a25e231b7e60ac 100644 --- a/services/distributeddataservice/app/src/uninstaller/uninstaller_impl.cpp +++ b/services/distributeddataservice/app/src/uninstaller/uninstaller_impl.cpp @@ -61,7 +61,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 = %{public}s", bundleName.c_str()); int userId = want.GetIntParam(USER_ID, -1); callback_(bundleName, userId); @@ -71,7 +71,7 @@ UninstallerImpl::~UninstallerImpl() { auto code = CommonEventManager::UnSubscribeCommonEvent(subscriber_); if (!code) { - ZLOGW("unsubscribe failed code=%d", code); + ZLOGW("unsubscribe failed code=%{public}d", code); } } @@ -90,7 +90,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=%{public}s", bundleName.c_str()); AppId appId = {kvStoreMetaData.bundleName}; StoreId storeId = {kvStoreMetaData.storeId}; kvStoreDataService->DeleteKvStore(appId, storeId); @@ -106,16 +106,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=%{public}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/service/rdb/rdb_service_impl.cpp b/services/distributeddataservice/service/rdb/rdb_service_impl.cpp index 51aeb575d180a1c7095c061666228b1d5304c980..0ad582e5b1c9e12003e7a050a97cd6166c146f20 100644 --- a/services/distributeddataservice/service/rdb/rdb_service_impl.cpp +++ b/services/distributeddataservice/service/rdb/rdb_service_impl.cpp @@ -344,7 +344,7 @@ int32_t RdbServiceImpl::DoSubscribe(const RdbSyncerParam& param) { pid_t pid = GetCallingPid(); auto identifier = GenIdentifier(param); - ZLOGI("%{public}s %{public}.6s %{public}d", param.storeName_.c_str(), identifier.c_str(), pid); + ZLOGI("name=%{public}s identifier=%{public}.6s pid=%{public}d", param.storeName_.c_str(), identifier.c_str(), pid); identifiers_.Insert(identifier, pid); return RDB_OK; } @@ -352,7 +352,7 @@ int32_t RdbServiceImpl::DoSubscribe(const RdbSyncerParam& param) int32_t RdbServiceImpl::DoUnSubscribe(const RdbSyncerParam& param) { auto identifier = GenIdentifier(param); - ZLOGI("%{public}s %{public}.6s", param.storeName_.c_str(), identifier.c_str()); + ZLOGI("name=%{public}s identifier=%{public}.6s", param.storeName_.c_str(), identifier.c_str()); identifiers_.Erase(identifier); return RDB_OK; }