Skip to content

Commit

Permalink
[ICD] Add logs to improve debuggability for storeEntry/removeEntry/re…
Browse files Browse the repository at this point in the history
…moveAllEntries (#36053)

* [ICD] Add log for storeEntry/removeEntry/removeAllEntires

* Restyled by clang-format

---------

Co-authored-by: Restyled.io <commits@restyled.io>
  • Loading branch information
yunhanw-google and restyled-commits authored Oct 17, 2024
1 parent 9b25203 commit 3a6c545
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/app/icd/client/DefaultICDClientStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,12 @@ CHIP_ERROR DefaultICDClientStorage::StoreEntry(const ICDClientInfo & clientInfo)
DefaultStorageKeyAllocator::ICDClientInfoKey(clientInfo.peer_node.GetFabricIndex()).KeyName(), backingBuffer.Get(),
static_cast<uint16_t>(len)));

return IncreaseEntryCountForFabric(clientInfo.peer_node.GetFabricIndex());
ReturnErrorOnFailure(IncreaseEntryCountForFabric(clientInfo.peer_node.GetFabricIndex()));
ChipLogProgress(ICD,
"Store ICD entry successfully with peer nodeId " ChipLogFormatScopedNodeId
" and checkin nodeId " ChipLogFormatScopedNodeId,
ChipLogValueScopedNodeId(clientInfo.peer_node), ChipLogValueScopedNodeId(clientInfo.check_in_node));
return CHIP_NO_ERROR;
}

CHIP_ERROR DefaultICDClientStorage::IncreaseEntryCountForFabric(FabricIndex fabricIndex)
Expand Down Expand Up @@ -475,7 +480,10 @@ CHIP_ERROR DefaultICDClientStorage::DeleteEntry(const ScopedNodeId & peerNode)
mpClientInfoStore->SyncSetKeyValue(DefaultStorageKeyAllocator::ICDClientInfoKey(peerNode.GetFabricIndex()).KeyName(),
backingBuffer.Get(), static_cast<uint16_t>(len)));

return DecreaseEntryCountForFabric(peerNode.GetFabricIndex());
ReturnErrorOnFailure(DecreaseEntryCountForFabric(peerNode.GetFabricIndex()));
ChipLogProgress(ICD, "Remove ICD entry successfully with peer nodeId " ChipLogFormatScopedNodeId,
ChipLogValueScopedNodeId(peerNode));
return CHIP_NO_ERROR;
}

CHIP_ERROR DefaultICDClientStorage::DeleteAllEntries(FabricIndex fabricIndex)
Expand Down Expand Up @@ -508,7 +516,10 @@ CHIP_ERROR DefaultICDClientStorage::DeleteAllEntries(FabricIndex fabricIndex)
{
return mpClientInfoStore->SyncDeleteKeyValue(DefaultStorageKeyAllocator::ICDFabricList().KeyName());
}
return StoreFabricList();

ReturnErrorOnFailure(StoreFabricList());
ChipLogProgress(ICD, "Remove all ICD entries successfully for fabric index %u", fabricIndex);
return CHIP_NO_ERROR;
}

CHIP_ERROR DefaultICDClientStorage::ProcessCheckInPayload(const ByteSpan & payload, ICDClientInfo & clientInfo,
Expand Down

0 comments on commit 3a6c545

Please sign in to comment.