Skip to content

Commit

Permalink
Add nodeid to logs in OperationalDeviceProxy.cpp (project-chip#21019)
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 authored and isiu-apple committed Sep 16, 2022
1 parent 7a1013a commit b89c8b2
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/app/OperationalDeviceProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@ void OperationalDeviceProxy::UpdateDeviceData(const Transport::PeerAddress & add
char peerAddrBuff[Transport::PeerAddress::kMaxToStringSize];
addr.ToString(peerAddrBuff);

ChipLogDetail(Controller, "Updating device address to %s while in state %d", peerAddrBuff, static_cast<int>(mState));
ChipLogDetail(Discovery,
"OperationalDeviceProxy[" ChipLogFormatX64 ":" ChipLogFormatX64
"]: Updating device address to %s while in state %d",
ChipLogValueX64(mPeerId.GetCompressedFabricId()), ChipLogValueX64(mPeerId.GetNodeId()), peerAddrBuff,
static_cast<int>(mState));
#endif

CHIP_ERROR err = CHIP_NO_ERROR;
Expand Down Expand Up @@ -366,7 +370,10 @@ OperationalDeviceProxy::~OperationalDeviceProxy()
{
if (mAddressLookupHandle.IsActive())
{
ChipLogProgress(Discovery, "Cancelling incomplete address resolution as device is being deleted.");
ChipLogDetail(Discovery,
"OperationalDeviceProxy[" ChipLogFormatX64 ":" ChipLogFormatX64
"]: Cancelling incomplete address resolution as device is being deleted.",
ChipLogValueX64(mPeerId.GetCompressedFabricId()), ChipLogValueX64(mPeerId.GetNodeId()));

// Skip cancel callback since the destructor is being called, so we assume that this object is
// obviously not used anymore
Expand All @@ -391,7 +398,10 @@ CHIP_ERROR OperationalDeviceProxy::LookupPeerAddress()
// MoveToState calls in this method.
if (mAddressLookupHandle.IsActive())
{
ChipLogProgress(Discovery, "Operational node lookup already in progress. Will NOT start a new one.");
ChipLogProgress(Discovery,
"OperationalDeviceProxy[" ChipLogFormatX64 ":" ChipLogFormatX64
"]: Operational node lookup already in progress. Will NOT start a new one.",
ChipLogValueX64(mPeerId.GetCompressedFabricId()), ChipLogValueX64(mPeerId.GetNodeId()));
return CHIP_NO_ERROR;
}

Expand All @@ -407,8 +417,10 @@ void OperationalDeviceProxy::OnNodeAddressResolved(const PeerId & peerId, const

void OperationalDeviceProxy::OnNodeAddressResolutionFailed(const PeerId & peerId, CHIP_ERROR reason)
{
ChipLogError(Discovery, "Operational discovery failed for 0x" ChipLogFormatX64 ": %" CHIP_ERROR_FORMAT,
ChipLogValueX64(peerId.GetNodeId()), reason.Format());
ChipLogError(Discovery,
"OperationalDeviceProxy[" ChipLogFormatX64 ":" ChipLogFormatX64
"]: operational discovery failed: %" CHIP_ERROR_FORMAT,
ChipLogValueX64(mPeerId.GetCompressedFabricId()), ChipLogValueX64(mPeerId.GetNodeId()), reason.Format());

if (IsResolvingAddress())
{
Expand Down

0 comments on commit b89c8b2

Please sign in to comment.