Threadcrumb simplifies metadata logging by embedding information directly into threads, ensuring their visibility in backtraces during collection. It offers a straightforward approach to enhance traceability, enabling seamless logging of metadata within threads. With Threadcrumb, you can easily integrate metadata logging into your applications, improving their debugging and diagnostic capabilities.
Threadcrumb can be integrated into your project using Swift Package Manager (SPM) or by directly adding the source files to your Xcode project.
- In Xcode, select File > Swift Packages > Add Package Dependency...
- Enter the repository URL
https://github.com/naftaly/threadcrumb.git
. - Specify the version or branch you want to use.
- Follow the prompts to complete the integration.
- Download the Threadcrumb source files.
- Drag and drop the source files into your Xcode project.
- Make sure to add the necessary import statements where you want to use Threadcrumb.
let threadcrumb = Threadcrumb(identifier: "com.crumb.appstate")
threadcrumb.log("appstate_active")
let appstate = "active"
threadcrumb.log("appstate_%@", appstate)
See Threadcrumb.stringLoggingThread
for an example how to extract your logs from a stacktrace.
You might want to do this on the backend when collecting backtraces from MetricKit for example.
- Swift 5.0+
- iOS 16.0+ / macOS 13.0+ / tvOS 16.0+ / watchOS 9.0+ / visionOS 1.0+
Threadcrumb is available under the MIT license. See the LICENSE file for more information.