Skip to content

Commit

Permalink
Updating logs in darwin framework to enable more by default (project-…
Browse files Browse the repository at this point in the history
…chip#33537)

* Updating logs

* Restyled by clang-format

* Updating logs

* Updating logs

* Restyled by clang-format

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
woody-apple and restyled-commits authored May 22, 2024
1 parent ca4b699 commit dd55376
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/darwin/Framework/CHIP/MTRCertificates.mm
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ + (MTRCertificateTLVBytes _Nullable)convertX509Certificate:(MTRCertificateDERByt
return nil;
}

MTR_LOG_INFO("convertX509Certificate: Success");
MTR_LOG_DEBUG("convertX509Certificate: Success");

return AsData(chipCertBytes);
}
Expand Down
14 changes: 7 additions & 7 deletions src/darwin/Framework/CHIP/MTRDevice.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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];
}];
Expand Down Expand Up @@ -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<unsigned long>(dataVersions.count));
MTR_LOG_DEBUG("%@ _getCachedDataVersions dataVersions count: %lu", self, static_cast<unsigned long>(dataVersions.count));

return dataVersions;
}
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -2759,7 +2759,7 @@ - (NSArray *)_getAttributesToReportWithReportedValues:(NSArray<NSDictionary<NSSt
if (attributeError) {
shouldReportAttribute = YES;
previousValue = [self _cachedAttributeValueForPath:attributePath];
MTR_LOG_INFO("%@ report %@ error %@ purge expected value %@ read cache %@", self, attributePath, attributeError,
MTR_LOG_ERROR("%@ report %@ error %@ purge expected value %@ read cache %@", self, attributePath, attributeError,
_expectedValueCache[attributePath], previousValue);
_expectedValueCache[attributePath] = nil;
// TODO: Is this clearing business really what we want?
Expand Down Expand Up @@ -2911,7 +2911,7 @@ - (void)_setLastInitialSubscribeLatency:(id)latency

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

std::lock_guard lock(_lock);

Expand Down
2 changes: 1 addition & 1 deletion src/darwin/Framework/CHIP/MTRDeviceController.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 13 additions & 13 deletions src/darwin/Framework/CHIP/MTRDeviceControllerDataStore.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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<unsigned long>(clusterIndexCopy.count), nodeID.unsignedLongLongValue, endpointID.unsignedShortValue);
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);
}
}
}
Expand All @@ -612,7 +612,7 @@ - (void)_pruneEmptyStoredClusterDataBranches
}
if (!success) {
storeFailures++;
MTR_LOG_INFO("Store failed in _pruneEmptyStoredClusterDataBranches for endpointIndex (%lu) @ node 0x%016llX", static_cast<unsigned long>(endpointIndexCopy.count), nodeID.unsignedLongLongValue);
MTR_LOG_ERROR("Store failed in _pruneEmptyStoredClusterDataBranches for endpointIndex (%lu) @ node 0x%016llX", static_cast<unsigned long>(endpointIndexCopy.count), nodeID.unsignedLongLongValue);
}
}
}
Expand All @@ -626,7 +626,7 @@ - (void)_pruneEmptyStoredClusterDataBranches
}
if (!success) {
storeFailures++;
MTR_LOG_INFO("Store failed in _pruneEmptyStoredClusterDataBranches for nodeIndex (%lu)", static_cast<unsigned long>(nodeIndexCopy.count));
MTR_LOG_ERROR("Store failed in _pruneEmptyStoredClusterDataBranches for nodeIndex (%lu)", static_cast<unsigned long>(nodeIndexCopy.count));
}
}

Expand Down Expand Up @@ -656,23 +656,23 @@ - (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++;
}
}

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++;
}
}

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<unsigned long>(endpointsCleared), static_cast<unsigned long>(endpointsClearAttempts), static_cast<unsigned long>(clusterDataCleared), static_cast<unsigned long>(clusterDataClearAttempts));
Expand All @@ -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<unsigned long>(nodeIndexCopy.count));
MTR_LOG_ERROR("Store failed in clearStoredAttributesForNodeID for nodeIndex (%lu)", static_cast<unsigned long>(nodeIndexCopy.count));
}
}
});
Expand All @@ -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");
}
});
}
Expand Down Expand Up @@ -906,7 +906,7 @@ - (void)storeClusterData:(NSDictionary<MTRClusterPath *, MTRDeviceClusterData *>
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);
}
}

Expand Down Expand Up @@ -962,7 +962,7 @@ - (void)storeClusterData:(NSDictionary<MTRClusterPath *, MTRDeviceClusterData *>
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;
}
}
Expand All @@ -977,7 +977,7 @@ - (void)storeClusterData:(NSDictionary<MTRClusterPath *, MTRDeviceClusterData *>
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);
}
}
}
Expand All @@ -999,7 +999,7 @@ - (void)storeClusterData:(NSDictionary<MTRClusterPath *, MTRDeviceClusterData *>
BOOL storeFailed = ![self _storeNodeIndex:nodeIndexToStore];
if (storeFailed) {
storeFailures++;
MTR_LOG_INFO("Store failed for nodeIndex");
MTR_LOG_ERROR("Store failed for nodeIndex");
}
}
}
Expand All @@ -1008,7 +1008,7 @@ - (void)storeClusterData:(NSDictionary<MTRClusterPath *, MTRDeviceClusterData *>
BOOL storeFailed = ![self _bulkStoreAttributeCacheValues:bulkValuesToStore];
if (storeFailed) {
storeFailures++;
MTR_LOG_INFO("Store failed for bulk values count %lu", static_cast<unsigned long>(bulkValuesToStore.count));
MTR_LOG_ERROR("Store failed for bulk values count %lu", static_cast<unsigned long>(bulkValuesToStore.count));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/darwin/Framework/CHIP/MTRLogging_Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit dd55376

Please sign in to comment.