Skip to content

Commit fa3a52c

Browse files
yunhanw-googlerestyled-commits
authored andcommitted
[nrf fromtree] [ICD] Add logs to improve debuggability for storeEntry/removeEntry/removeAllEntries (project-chip#36053) (project-chip#36149)
* [ICD] Add log for storeEntry/removeEntry/removeAllEntires * Restyled by clang-format --------- Co-authored-by: Restyled.io <commits@restyled.io> (cherry picked from commit 1f65167) Signed-off-by: Adrian Gielniewski <adrian.gielniewski@nordicsemi.no>
1 parent b288970 commit fa3a52c

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/app/icd/client/DefaultICDClientStorage.cpp

+14-3
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,12 @@ CHIP_ERROR DefaultICDClientStorage::StoreEntry(const ICDClientInfo & clientInfo)
394394
DefaultStorageKeyAllocator::ICDClientInfoKey(clientInfo.peer_node.GetFabricIndex()).KeyName(), backingBuffer.Get(),
395395
static_cast<uint16_t>(len)));
396396

397-
return IncreaseEntryCountForFabric(clientInfo.peer_node.GetFabricIndex());
397+
ReturnErrorOnFailure(IncreaseEntryCountForFabric(clientInfo.peer_node.GetFabricIndex()));
398+
ChipLogProgress(ICD,
399+
"Store ICD entry successfully with peer nodeId " ChipLogFormatScopedNodeId
400+
" and checkin nodeId " ChipLogFormatScopedNodeId,
401+
ChipLogValueScopedNodeId(clientInfo.peer_node), ChipLogValueScopedNodeId(clientInfo.check_in_node));
402+
return CHIP_NO_ERROR;
398403
}
399404

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

478-
return DecreaseEntryCountForFabric(peerNode.GetFabricIndex());
483+
ReturnErrorOnFailure(DecreaseEntryCountForFabric(peerNode.GetFabricIndex()));
484+
ChipLogProgress(ICD, "Remove ICD entry successfully with peer nodeId " ChipLogFormatScopedNodeId,
485+
ChipLogValueScopedNodeId(peerNode));
486+
return CHIP_NO_ERROR;
479487
}
480488

481489
CHIP_ERROR DefaultICDClientStorage::DeleteAllEntries(FabricIndex fabricIndex)
@@ -508,7 +516,10 @@ CHIP_ERROR DefaultICDClientStorage::DeleteAllEntries(FabricIndex fabricIndex)
508516
{
509517
return mpClientInfoStore->SyncDeleteKeyValue(DefaultStorageKeyAllocator::ICDFabricList().KeyName());
510518
}
511-
return StoreFabricList();
519+
520+
ReturnErrorOnFailure(StoreFabricList());
521+
ChipLogProgress(ICD, "Remove all ICD entries successfully for fabric index %u", fabricIndex);
522+
return CHIP_NO_ERROR;
512523
}
513524

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

0 commit comments

Comments
 (0)