@@ -268,16 +268,24 @@ using LogRedirectCallback_t = void (*)(const char * module, uint8_t category, co
268
268
#define ChipLogValueMEI (aValue ) static_cast <uint16_t >(aValue >> 16 ), static_cast <uint16_t >(aValue)
269
269
270
270
/* *
271
- * Logging helpers for exchanges. For now just log the exchange id and whether
272
- * it's an initiator or responder, but eventually we may want to log the peer
273
- * node id as well (especially for the responder case). Some callsites only
271
+ * Logging helpers for exchanges. Log the exchange id, whether
272
+ * it's an initiator or responder and the scoped node. Some callsites only
274
273
* have the exchange id and initiator/responder boolean, not an actual exchange,
275
274
* so we want to have a helper for that case too.
276
275
*/
277
276
#define ChipLogFormatExchangeId " %u%c"
278
277
#define ChipLogValueExchangeId (id, isInitiator ) id, ((isInitiator) ? ' i' : ' r' )
278
+
279
+ #if CHIP_EXCHANGE_NODE_ID_LOGGING
280
+ #define ChipLogFormatExchange ChipLogFormatExchangeId " with Node: " ChipLogFormatScopedNodeId
281
+ #define ChipLogValueExchange (ec ) \
282
+ ChipLogValueExchangeId ((ec)->GetExchangeId(), (ec)->IsInitiator()), \
283
+ ChipLogValueScopedNodeId((ec)->HasSessionHandle() ? (ec)->GetSessionHandle()->GetPeer() : ScopedNodeId())
284
+ #else // CHIP_EXCHANGE_NODE_ID_LOGGING
279
285
#define ChipLogFormatExchange ChipLogFormatExchangeId
280
286
#define ChipLogValueExchange (ec ) ChipLogValueExchangeId((ec)->GetExchangeId (), (ec)->IsInitiator())
287
+ #endif // CHIP_EXCHANGE_NODE_ID_LOGGING
288
+
281
289
#define ChipLogValueExchangeIdFromSentHeader (payloadHeader ) \
282
290
ChipLogValueExchangeId ((payloadHeader).GetExchangeID(), (payloadHeader).IsInitiator())
283
291
// A received header's initiator boolean is the inverse of the exchange's.
0 commit comments