From dd55376a594353892f04e2cdfd2fcefef2c2a0dc Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Tue, 21 May 2024 19:10:34 -0700 Subject: [PATCH] Updating logs in darwin framework to enable more by default (#33537) * Updating logs * Restyled by clang-format * Updating logs * Updating logs * Restyled by clang-format --------- Co-authored-by: Restyled.io --- src/darwin/Framework/CHIP/MTRCertificates.mm | 2 +- src/darwin/Framework/CHIP/MTRDevice.mm | 14 +++++----- .../Framework/CHIP/MTRDeviceController.h | 2 +- .../CHIP/MTRDeviceControllerDataStore.mm | 26 +++++++++---------- .../Framework/CHIP/MTRLogging_Internal.h | 2 +- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRCertificates.mm b/src/darwin/Framework/CHIP/MTRCertificates.mm index 9444ae920cc44c..725a812ca49d40 100644 --- a/src/darwin/Framework/CHIP/MTRCertificates.mm +++ b/src/darwin/Framework/CHIP/MTRCertificates.mm @@ -250,7 +250,7 @@ + (MTRCertificateTLVBytes _Nullable)convertX509Certificate:(MTRCertificateDERByt return nil; } - MTR_LOG_INFO("convertX509Certificate: Success"); + MTR_LOG_DEBUG("convertX509Certificate: Success"); return AsData(chipCertBytes); } diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index 4fca9139b87d2c..6e321c1a38d930 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -442,7 +442,7 @@ - (instancetype)initWithNodeID:(NSNumber *)nodeID controller:(MTRDeviceControlle } _clusterDataToPersist = nil; _persistedClusters = [NSMutableSet set]; - MTR_LOG_INFO("%@ init with hex nodeID 0x%016llX", self, _nodeID.unsignedLongLongValue); + MTR_LOG_DEBUG("%@ init with hex nodeID 0x%016llX", self, _nodeID.unsignedLongLongValue); } return self; } @@ -1125,7 +1125,7 @@ - (void)_handleResubscriptionNeededWithDelay:(NSNumber *)resubscriptionDelayMs [self _triggerResubscribeWithReason:"ResubscriptionNeeded timer fired" nodeLikelyReachable:NO]; } errorHandler:^(NSError * _Nonnull error) { // If controller is not running, clear work item from the subscription queue - MTR_LOG_INFO("%@ could not dispatch to matter queue for resubscription - error %@", self, error); + MTR_LOG_ERROR("%@ could not dispatch to matter queue for resubscription - error %@", self, error); std::lock_guard lock(self->_lock); [self _clearSubscriptionPoolWork]; }]; @@ -1554,7 +1554,7 @@ - (nullable MTRDeviceClusterData *)_clusterDataForPath:(MTRClusterPath *)cluster dataVersions[path] = [self _clusterDataForPath:path].dataVersion; } - MTR_LOG_INFO("%@ _getCachedDataVersions dataVersions count: %lu", self, static_cast(dataVersions.count)); + MTR_LOG_DEBUG("%@ _getCachedDataVersions dataVersions count: %lu", self, static_cast(dataVersions.count)); return dataVersions; } @@ -1644,7 +1644,7 @@ - (void)_setupConnectivityMonitoring // Get the required info before setting up the connectivity monitor NSNumber * compressedFabricID = [self->_deviceController syncGetCompressedFabricID]; if (!compressedFabricID) { - MTR_LOG_INFO("%@ could not get compressed fabricID", self); + MTR_LOG_ERROR("%@ could not get compressed fabricID", self); return; } @@ -1748,7 +1748,7 @@ - (void)_setupSubscription }); }, ^(NSError * error, NSNumber * resubscriptionDelayMs) { - MTR_LOG_DEFAULT("%@ got resubscription error %@ delay %@", self, error, resubscriptionDelayMs); + MTR_LOG_ERROR("%@ got resubscription error %@ delay %@", self, error, resubscriptionDelayMs); dispatch_async(self.queue, ^{ // OnResubscriptionNeeded [self _handleResubscriptionNeededWithDelay:resubscriptionDelayMs]; @@ -2759,7 +2759,7 @@ - (NSArray *)_getAttributesToReportWithReportedValues:(NSArray *)data { - MTR_LOG_INFO("%@ setPersistedDeviceData: %@", self, data); + MTR_LOG_DEBUG("%@ setPersistedDeviceData: %@", self, data); std::lock_guard lock(_lock); diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.h b/src/darwin/Framework/CHIP/MTRDeviceController.h index 09c480f0568754..eaae1fcf7d4c6a 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.h +++ b/src/darwin/Framework/CHIP/MTRDeviceController.h @@ -54,7 +54,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) * if it has not already been started. * 2) Return nil or a running controller. * - * Once this returns non-nil, it's the caller's resposibility to call shutdown + * Once this returns non-nil, it's the caller's responsibility to call shutdown * on the controller to avoid leaking it. */ - (nullable instancetype)initWithParameters:(MTRDeviceControllerAbstractParameters *)parameters diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDataStore.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerDataStore.mm index 7b65f8e963dfa3..d2a3cf4ca73693 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDataStore.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDataStore.mm @@ -597,7 +597,7 @@ - (void)_pruneEmptyStoredClusterDataBranches } if (!success) { storeFailures++; - MTR_LOG_INFO("Store failed in _pruneEmptyStoredClusterDataBranches for clusterIndex (%lu) @ node 0x%016llX endpoint %u", static_cast(clusterIndexCopy.count), nodeID.unsignedLongLongValue, endpointID.unsignedShortValue); + MTR_LOG_ERROR("Store failed in _pruneEmptyStoredClusterDataBranches for clusterIndex (%lu) @ node 0x%016llX endpoint %u", static_cast(clusterIndexCopy.count), nodeID.unsignedLongLongValue, endpointID.unsignedShortValue); } } } @@ -612,7 +612,7 @@ - (void)_pruneEmptyStoredClusterDataBranches } if (!success) { storeFailures++; - MTR_LOG_INFO("Store failed in _pruneEmptyStoredClusterDataBranches for endpointIndex (%lu) @ node 0x%016llX", static_cast(endpointIndexCopy.count), nodeID.unsignedLongLongValue); + MTR_LOG_ERROR("Store failed in _pruneEmptyStoredClusterDataBranches for endpointIndex (%lu) @ node 0x%016llX", static_cast(endpointIndexCopy.count), nodeID.unsignedLongLongValue); } } } @@ -626,7 +626,7 @@ - (void)_pruneEmptyStoredClusterDataBranches } if (!success) { storeFailures++; - MTR_LOG_INFO("Store failed in _pruneEmptyStoredClusterDataBranches for nodeIndex (%lu)", static_cast(nodeIndexCopy.count)); + MTR_LOG_ERROR("Store failed in _pruneEmptyStoredClusterDataBranches for nodeIndex (%lu)", static_cast(nodeIndexCopy.count)); } } @@ -656,7 +656,7 @@ - (void)_clearStoredClusterDataForNodeID:(NSNumber *)nodeID for (NSNumber * clusterID in clusterIndex) { BOOL success = [self _deleteClusterDataForNodeID:nodeID endpointID:endpointID clusterID:clusterID]; if (!success) { - MTR_LOG_INFO("Delete failed for clusterData @ node 0x%016llX endpoint %u cluster 0x%08lX", nodeID.unsignedLongLongValue, endpointID.unsignedShortValue, clusterID.unsignedLongValue); + MTR_LOG_ERROR("Delete failed for clusterData @ node 0x%016llX endpoint %u cluster 0x%08lX", nodeID.unsignedLongLongValue, endpointID.unsignedShortValue, clusterID.unsignedLongValue); } else { clusterDataCleared++; } @@ -664,7 +664,7 @@ - (void)_clearStoredClusterDataForNodeID:(NSNumber *)nodeID BOOL success = [self _deleteClusterIndexForNodeID:nodeID endpointID:endpointID]; if (!success) { - MTR_LOG_INFO("Delete failed for clusterIndex @ node 0x%016llX endpoint %u", nodeID.unsignedLongLongValue, endpointID.unsignedShortValue); + MTR_LOG_ERROR("Delete failed for clusterIndex @ node 0x%016llX endpoint %u", nodeID.unsignedLongLongValue, endpointID.unsignedShortValue); } else { endpointsCleared++; } @@ -672,7 +672,7 @@ - (void)_clearStoredClusterDataForNodeID:(NSNumber *)nodeID BOOL success = [self _deleteEndpointIndexForNodeID:nodeID]; if (!success) { - MTR_LOG_INFO("Delete failed for endpointIndex @ node 0x%016llX", nodeID.unsignedLongLongValue); + MTR_LOG_ERROR("Delete failed for endpointIndex @ node 0x%016llX", nodeID.unsignedLongLongValue); } MTR_LOG_INFO("clearStoredClusterDataForNodeID: deleted endpoints %lu/%lu clusters %lu/%lu", static_cast(endpointsCleared), static_cast(endpointsClearAttempts), static_cast(clusterDataCleared), static_cast(clusterDataClearAttempts)); @@ -693,7 +693,7 @@ - (void)clearStoredClusterDataForNodeID:(NSNumber *)nodeID success = [self _deleteNodeIndex]; } if (!success) { - MTR_LOG_INFO("Store failed in clearStoredAttributesForNodeID for nodeIndex (%lu)", static_cast(nodeIndexCopy.count)); + MTR_LOG_ERROR("Store failed in clearStoredAttributesForNodeID for nodeIndex (%lu)", static_cast(nodeIndexCopy.count)); } } }); @@ -711,7 +711,7 @@ - (void)clearAllStoredClusterData BOOL success = [self _deleteNodeIndex]; if (!success) { - MTR_LOG_INFO("Delete failed for nodeIndex"); + MTR_LOG_ERROR("Delete failed for nodeIndex"); } }); } @@ -906,7 +906,7 @@ - (void)storeClusterData:(NSDictionary BOOL storeFailed = ![self _storeClusterData:data forNodeID:nodeID endpointID:path.endpoint clusterID:path.cluster]; if (storeFailed) { storeFailures++; - MTR_LOG_INFO("Store failed for clusterData @ node 0x%016llX endpoint %u cluster 0x%08lX", nodeID.unsignedLongLongValue, path.endpoint.unsignedShortValue, path.cluster.unsignedLongValue); + MTR_LOG_ERROR("Store failed for clusterData @ node 0x%016llX endpoint %u cluster 0x%08lX", nodeID.unsignedLongLongValue, path.endpoint.unsignedShortValue, path.cluster.unsignedLongValue); } } @@ -962,7 +962,7 @@ - (void)storeClusterData:(NSDictionary BOOL storeFailed = ![self _storeClusterIndex:clusterIndexToStore forNodeID:nodeID endpointID:endpointID]; if (storeFailed) { storeFailures++; - MTR_LOG_INFO("Store failed for clusterIndex @ node 0x%016llX endpoint %u", nodeID.unsignedLongLongValue, endpointID.unsignedShortValue); + MTR_LOG_ERROR("Store failed for clusterIndex @ node 0x%016llX endpoint %u", nodeID.unsignedLongLongValue, endpointID.unsignedShortValue); continue; } } @@ -977,7 +977,7 @@ - (void)storeClusterData:(NSDictionary BOOL storeFailed = ![self _storeEndpointIndex:endpointIndexToStore forNodeID:nodeID]; if (storeFailed) { storeFailures++; - MTR_LOG_INFO("Store failed for endpointIndex @ node 0x%016llX", nodeID.unsignedLongLongValue); + MTR_LOG_ERROR("Store failed for endpointIndex @ node 0x%016llX", nodeID.unsignedLongLongValue); } } } @@ -999,7 +999,7 @@ - (void)storeClusterData:(NSDictionary BOOL storeFailed = ![self _storeNodeIndex:nodeIndexToStore]; if (storeFailed) { storeFailures++; - MTR_LOG_INFO("Store failed for nodeIndex"); + MTR_LOG_ERROR("Store failed for nodeIndex"); } } } @@ -1008,7 +1008,7 @@ - (void)storeClusterData:(NSDictionary BOOL storeFailed = ![self _bulkStoreAttributeCacheValues:bulkValuesToStore]; if (storeFailed) { storeFailures++; - MTR_LOG_INFO("Store failed for bulk values count %lu", static_cast(bulkValuesToStore.count)); + MTR_LOG_ERROR("Store failed for bulk values count %lu", static_cast(bulkValuesToStore.count)); } } diff --git a/src/darwin/Framework/CHIP/MTRLogging_Internal.h b/src/darwin/Framework/CHIP/MTRLogging_Internal.h index 9b2d2fce418822..27ee9b9dda301e 100644 --- a/src/darwin/Framework/CHIP/MTRLogging_Internal.h +++ b/src/darwin/Framework/CHIP/MTRLogging_Internal.h @@ -22,5 +22,5 @@ #define MTR_LOG_ERROR(msg, ...) ChipLogError(NotSpecified, msg, ##__VA_ARGS__) #define MTR_LOG_DEFAULT(msg, ...) ChipLogProgress(NotSpecified, msg, ##__VA_ARGS__) -#define MTR_LOG_INFO(msg, ...) ChipLogDetail(NotSpecified, msg, ##__VA_ARGS__) +#define MTR_LOG_INFO(msg, ...) ChipLogProgress(NotSpecified, msg, ##__VA_ARGS__) #define MTR_LOG_DEBUG(msg, ...) ChipLogDetail(NotSpecified, msg, ##__VA_ARGS__) // same as INFO