how to print which thread is a func is on

Asked on 08/07/2024

1 search

To print which thread a function is on, you can use the os_log API for more structured logging instead of simple print statements. This approach provides more metadata, including thread information, which can be very useful for debugging.

Here's a brief overview of how you can achieve this:

  1. Use os_log for structured logging: This allows you to include metadata such as thread information in your logs.
  2. Set breakpoints and use LLDB: You can set breakpoints in Xcode and use LLDB commands to inspect the thread information.

For more detailed information on debugging and logging, you can refer to the following sessions from WWDC:

By using these tools and techniques, you can effectively determine which thread a function is running on and improve your debugging process.