Skip to content

Commit dd55376

Browse files
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 <commits@restyled.io>
1 parent ca4b699 commit dd55376

5 files changed

+23
-23
lines changed

src/darwin/Framework/CHIP/MTRCertificates.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ + (MTRCertificateTLVBytes _Nullable)convertX509Certificate:(MTRCertificateDERByt
250250
return nil;
251251
}
252252

253-
MTR_LOG_INFO("convertX509Certificate: Success");
253+
MTR_LOG_DEBUG("convertX509Certificate: Success");
254254

255255
return AsData(chipCertBytes);
256256
}

src/darwin/Framework/CHIP/MTRDevice.mm

+7-7
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ - (instancetype)initWithNodeID:(NSNumber *)nodeID controller:(MTRDeviceControlle
442442
}
443443
_clusterDataToPersist = nil;
444444
_persistedClusters = [NSMutableSet set];
445-
MTR_LOG_INFO("%@ init with hex nodeID 0x%016llX", self, _nodeID.unsignedLongLongValue);
445+
MTR_LOG_DEBUG("%@ init with hex nodeID 0x%016llX", self, _nodeID.unsignedLongLongValue);
446446
}
447447
return self;
448448
}
@@ -1125,7 +1125,7 @@ - (void)_handleResubscriptionNeededWithDelay:(NSNumber *)resubscriptionDelayMs
11251125
[self _triggerResubscribeWithReason:"ResubscriptionNeeded timer fired" nodeLikelyReachable:NO];
11261126
} errorHandler:^(NSError * _Nonnull error) {
11271127
// If controller is not running, clear work item from the subscription queue
1128-
MTR_LOG_INFO("%@ could not dispatch to matter queue for resubscription - error %@", self, error);
1128+
MTR_LOG_ERROR("%@ could not dispatch to matter queue for resubscription - error %@", self, error);
11291129
std::lock_guard lock(self->_lock);
11301130
[self _clearSubscriptionPoolWork];
11311131
}];
@@ -1554,7 +1554,7 @@ - (nullable MTRDeviceClusterData *)_clusterDataForPath:(MTRClusterPath *)cluster
15541554
dataVersions[path] = [self _clusterDataForPath:path].dataVersion;
15551555
}
15561556

1557-
MTR_LOG_INFO("%@ _getCachedDataVersions dataVersions count: %lu", self, static_cast<unsigned long>(dataVersions.count));
1557+
MTR_LOG_DEBUG("%@ _getCachedDataVersions dataVersions count: %lu", self, static_cast<unsigned long>(dataVersions.count));
15581558

15591559
return dataVersions;
15601560
}
@@ -1644,7 +1644,7 @@ - (void)_setupConnectivityMonitoring
16441644
// Get the required info before setting up the connectivity monitor
16451645
NSNumber * compressedFabricID = [self->_deviceController syncGetCompressedFabricID];
16461646
if (!compressedFabricID) {
1647-
MTR_LOG_INFO("%@ could not get compressed fabricID", self);
1647+
MTR_LOG_ERROR("%@ could not get compressed fabricID", self);
16481648
return;
16491649
}
16501650

@@ -1748,7 +1748,7 @@ - (void)_setupSubscription
17481748
});
17491749
},
17501750
^(NSError * error, NSNumber * resubscriptionDelayMs) {
1751-
MTR_LOG_DEFAULT("%@ got resubscription error %@ delay %@", self, error, resubscriptionDelayMs);
1751+
MTR_LOG_ERROR("%@ got resubscription error %@ delay %@", self, error, resubscriptionDelayMs);
17521752
dispatch_async(self.queue, ^{
17531753
// OnResubscriptionNeeded
17541754
[self _handleResubscriptionNeededWithDelay:resubscriptionDelayMs];
@@ -2759,7 +2759,7 @@ - (NSArray *)_getAttributesToReportWithReportedValues:(NSArray<NSDictionary<NSSt
27592759
if (attributeError) {
27602760
shouldReportAttribute = YES;
27612761
previousValue = [self _cachedAttributeValueForPath:attributePath];
2762-
MTR_LOG_INFO("%@ report %@ error %@ purge expected value %@ read cache %@", self, attributePath, attributeError,
2762+
MTR_LOG_ERROR("%@ report %@ error %@ purge expected value %@ read cache %@", self, attributePath, attributeError,
27632763
_expectedValueCache[attributePath], previousValue);
27642764
_expectedValueCache[attributePath] = nil;
27652765
// TODO: Is this clearing business really what we want?
@@ -2911,7 +2911,7 @@ - (void)_setLastInitialSubscribeLatency:(id)latency
29112911

29122912
- (void)setPersistedDeviceData:(NSDictionary<NSString *, id> *)data
29132913
{
2914-
MTR_LOG_INFO("%@ setPersistedDeviceData: %@", self, data);
2914+
MTR_LOG_DEBUG("%@ setPersistedDeviceData: %@", self, data);
29152915

29162916
std::lock_guard lock(_lock);
29172917

src/darwin/Framework/CHIP/MTRDeviceController.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1))
5454
* if it has not already been started.
5555
* 2) Return nil or a running controller.
5656
*
57-
* Once this returns non-nil, it's the caller's resposibility to call shutdown
57+
* Once this returns non-nil, it's the caller's responsibility to call shutdown
5858
* on the controller to avoid leaking it.
5959
*/
6060
- (nullable instancetype)initWithParameters:(MTRDeviceControllerAbstractParameters *)parameters

src/darwin/Framework/CHIP/MTRDeviceControllerDataStore.mm

+13-13
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ - (void)_pruneEmptyStoredClusterDataBranches
597597
}
598598
if (!success) {
599599
storeFailures++;
600-
MTR_LOG_INFO("Store failed in _pruneEmptyStoredClusterDataBranches for clusterIndex (%lu) @ node 0x%016llX endpoint %u", static_cast<unsigned long>(clusterIndexCopy.count), nodeID.unsignedLongLongValue, endpointID.unsignedShortValue);
600+
MTR_LOG_ERROR("Store failed in _pruneEmptyStoredClusterDataBranches for clusterIndex (%lu) @ node 0x%016llX endpoint %u", static_cast<unsigned long>(clusterIndexCopy.count), nodeID.unsignedLongLongValue, endpointID.unsignedShortValue);
601601
}
602602
}
603603
}
@@ -612,7 +612,7 @@ - (void)_pruneEmptyStoredClusterDataBranches
612612
}
613613
if (!success) {
614614
storeFailures++;
615-
MTR_LOG_INFO("Store failed in _pruneEmptyStoredClusterDataBranches for endpointIndex (%lu) @ node 0x%016llX", static_cast<unsigned long>(endpointIndexCopy.count), nodeID.unsignedLongLongValue);
615+
MTR_LOG_ERROR("Store failed in _pruneEmptyStoredClusterDataBranches for endpointIndex (%lu) @ node 0x%016llX", static_cast<unsigned long>(endpointIndexCopy.count), nodeID.unsignedLongLongValue);
616616
}
617617
}
618618
}
@@ -626,7 +626,7 @@ - (void)_pruneEmptyStoredClusterDataBranches
626626
}
627627
if (!success) {
628628
storeFailures++;
629-
MTR_LOG_INFO("Store failed in _pruneEmptyStoredClusterDataBranches for nodeIndex (%lu)", static_cast<unsigned long>(nodeIndexCopy.count));
629+
MTR_LOG_ERROR("Store failed in _pruneEmptyStoredClusterDataBranches for nodeIndex (%lu)", static_cast<unsigned long>(nodeIndexCopy.count));
630630
}
631631
}
632632

@@ -656,23 +656,23 @@ - (void)_clearStoredClusterDataForNodeID:(NSNumber *)nodeID
656656
for (NSNumber * clusterID in clusterIndex) {
657657
BOOL success = [self _deleteClusterDataForNodeID:nodeID endpointID:endpointID clusterID:clusterID];
658658
if (!success) {
659-
MTR_LOG_INFO("Delete failed for clusterData @ node 0x%016llX endpoint %u cluster 0x%08lX", nodeID.unsignedLongLongValue, endpointID.unsignedShortValue, clusterID.unsignedLongValue);
659+
MTR_LOG_ERROR("Delete failed for clusterData @ node 0x%016llX endpoint %u cluster 0x%08lX", nodeID.unsignedLongLongValue, endpointID.unsignedShortValue, clusterID.unsignedLongValue);
660660
} else {
661661
clusterDataCleared++;
662662
}
663663
}
664664

665665
BOOL success = [self _deleteClusterIndexForNodeID:nodeID endpointID:endpointID];
666666
if (!success) {
667-
MTR_LOG_INFO("Delete failed for clusterIndex @ node 0x%016llX endpoint %u", nodeID.unsignedLongLongValue, endpointID.unsignedShortValue);
667+
MTR_LOG_ERROR("Delete failed for clusterIndex @ node 0x%016llX endpoint %u", nodeID.unsignedLongLongValue, endpointID.unsignedShortValue);
668668
} else {
669669
endpointsCleared++;
670670
}
671671
}
672672

673673
BOOL success = [self _deleteEndpointIndexForNodeID:nodeID];
674674
if (!success) {
675-
MTR_LOG_INFO("Delete failed for endpointIndex @ node 0x%016llX", nodeID.unsignedLongLongValue);
675+
MTR_LOG_ERROR("Delete failed for endpointIndex @ node 0x%016llX", nodeID.unsignedLongLongValue);
676676
}
677677

678678
MTR_LOG_INFO("clearStoredClusterDataForNodeID: deleted endpoints %lu/%lu clusters %lu/%lu", static_cast<unsigned long>(endpointsCleared), static_cast<unsigned long>(endpointsClearAttempts), static_cast<unsigned long>(clusterDataCleared), static_cast<unsigned long>(clusterDataClearAttempts));
@@ -693,7 +693,7 @@ - (void)clearStoredClusterDataForNodeID:(NSNumber *)nodeID
693693
success = [self _deleteNodeIndex];
694694
}
695695
if (!success) {
696-
MTR_LOG_INFO("Store failed in clearStoredAttributesForNodeID for nodeIndex (%lu)", static_cast<unsigned long>(nodeIndexCopy.count));
696+
MTR_LOG_ERROR("Store failed in clearStoredAttributesForNodeID for nodeIndex (%lu)", static_cast<unsigned long>(nodeIndexCopy.count));
697697
}
698698
}
699699
});
@@ -711,7 +711,7 @@ - (void)clearAllStoredClusterData
711711

712712
BOOL success = [self _deleteNodeIndex];
713713
if (!success) {
714-
MTR_LOG_INFO("Delete failed for nodeIndex");
714+
MTR_LOG_ERROR("Delete failed for nodeIndex");
715715
}
716716
});
717717
}
@@ -906,7 +906,7 @@ - (void)storeClusterData:(NSDictionary<MTRClusterPath *, MTRDeviceClusterData *>
906906
BOOL storeFailed = ![self _storeClusterData:data forNodeID:nodeID endpointID:path.endpoint clusterID:path.cluster];
907907
if (storeFailed) {
908908
storeFailures++;
909-
MTR_LOG_INFO("Store failed for clusterData @ node 0x%016llX endpoint %u cluster 0x%08lX", nodeID.unsignedLongLongValue, path.endpoint.unsignedShortValue, path.cluster.unsignedLongValue);
909+
MTR_LOG_ERROR("Store failed for clusterData @ node 0x%016llX endpoint %u cluster 0x%08lX", nodeID.unsignedLongLongValue, path.endpoint.unsignedShortValue, path.cluster.unsignedLongValue);
910910
}
911911
}
912912

@@ -962,7 +962,7 @@ - (void)storeClusterData:(NSDictionary<MTRClusterPath *, MTRDeviceClusterData *>
962962
BOOL storeFailed = ![self _storeClusterIndex:clusterIndexToStore forNodeID:nodeID endpointID:endpointID];
963963
if (storeFailed) {
964964
storeFailures++;
965-
MTR_LOG_INFO("Store failed for clusterIndex @ node 0x%016llX endpoint %u", nodeID.unsignedLongLongValue, endpointID.unsignedShortValue);
965+
MTR_LOG_ERROR("Store failed for clusterIndex @ node 0x%016llX endpoint %u", nodeID.unsignedLongLongValue, endpointID.unsignedShortValue);
966966
continue;
967967
}
968968
}
@@ -977,7 +977,7 @@ - (void)storeClusterData:(NSDictionary<MTRClusterPath *, MTRDeviceClusterData *>
977977
BOOL storeFailed = ![self _storeEndpointIndex:endpointIndexToStore forNodeID:nodeID];
978978
if (storeFailed) {
979979
storeFailures++;
980-
MTR_LOG_INFO("Store failed for endpointIndex @ node 0x%016llX", nodeID.unsignedLongLongValue);
980+
MTR_LOG_ERROR("Store failed for endpointIndex @ node 0x%016llX", nodeID.unsignedLongLongValue);
981981
}
982982
}
983983
}
@@ -999,7 +999,7 @@ - (void)storeClusterData:(NSDictionary<MTRClusterPath *, MTRDeviceClusterData *>
999999
BOOL storeFailed = ![self _storeNodeIndex:nodeIndexToStore];
10001000
if (storeFailed) {
10011001
storeFailures++;
1002-
MTR_LOG_INFO("Store failed for nodeIndex");
1002+
MTR_LOG_ERROR("Store failed for nodeIndex");
10031003
}
10041004
}
10051005
}
@@ -1008,7 +1008,7 @@ - (void)storeClusterData:(NSDictionary<MTRClusterPath *, MTRDeviceClusterData *>
10081008
BOOL storeFailed = ![self _bulkStoreAttributeCacheValues:bulkValuesToStore];
10091009
if (storeFailed) {
10101010
storeFailures++;
1011-
MTR_LOG_INFO("Store failed for bulk values count %lu", static_cast<unsigned long>(bulkValuesToStore.count));
1011+
MTR_LOG_ERROR("Store failed for bulk values count %lu", static_cast<unsigned long>(bulkValuesToStore.count));
10121012
}
10131013
}
10141014

src/darwin/Framework/CHIP/MTRLogging_Internal.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222

2323
#define MTR_LOG_ERROR(msg, ...) ChipLogError(NotSpecified, msg, ##__VA_ARGS__)
2424
#define MTR_LOG_DEFAULT(msg, ...) ChipLogProgress(NotSpecified, msg, ##__VA_ARGS__)
25-
#define MTR_LOG_INFO(msg, ...) ChipLogDetail(NotSpecified, msg, ##__VA_ARGS__)
25+
#define MTR_LOG_INFO(msg, ...) ChipLogProgress(NotSpecified, msg, ##__VA_ARGS__)
2626
#define MTR_LOG_DEBUG(msg, ...) ChipLogDetail(NotSpecified, msg, ##__VA_ARGS__) // same as INFO

0 commit comments

Comments
 (0)