Skip to content

Commit

Permalink
Adding logging to MTRDeviceController (#34320)
Browse files Browse the repository at this point in the history
* Adding logging

* Fixing string format

* Restyled by clang-format

* Ugh.

* Restyled by clang-format

---------

Co-authored-by: Restyled.io <commits@restyled.io>
  • Loading branch information
woody-apple and restyled-commits authored Jul 13, 2024
1 parent 702bae1 commit 7611b99
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/darwin/Framework/CHIP/MTRDeviceController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ - (void)shutdown
return;
}

MTR_LOG("Shutting down MTRDeviceController: %@", self);
[self cleanupAfterStartup];
}

Expand All @@ -306,6 +307,7 @@ - (void)cleanupAfterStartup
// do the secure session shutdowns. Since we don't want to hold the lock
// while calling out into arbitrary invalidation code, snapshot the list of
// devices before we start invalidating.
MTR_LOG("cleanupAfterStartup MTRDeviceController: %@", self);
os_unfair_lock_lock(&_deviceMapLock);
NSEnumerator * devices = [_nodeIDToDeviceMap objectEnumerator];
[_nodeIDToDeviceMap removeAllObjects];
Expand All @@ -323,6 +325,7 @@ - (void)cleanupAfterStartup
// in a very specific way that only MTRDeviceControllerFactory knows about.
- (void)shutDownCppController
{
MTR_LOG("shutDownCppController MTRDeviceController: %p", self);
assertChipStackLockedByCurrentThread();

// Shut down all our endpoints.
Expand Down Expand Up @@ -624,6 +627,7 @@ - (BOOL)startup:(MTRDeviceControllerStartupParamsInternal *)startupParams
});
}];
}
MTR_LOG("MTRDeviceController startup: %@", self);

return YES;
}
Expand Down Expand Up @@ -1259,7 +1263,7 @@ - (BOOL)checkIsRunning:(NSError * __autoreleasing *)error
return YES;
}

MTR_LOG_ERROR("Error: %s", [kErrorNotRunning UTF8String]);
MTR_LOG_ERROR("MTRDeviceController: %@ Error: %s", self, [kErrorNotRunning UTF8String]);
if (error) {
*error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE];
}
Expand Down

0 comments on commit 7611b99

Please sign in to comment.