Threadcrumb

1.0.1

Swift no-nonsense dependency-free breadcrumb logger.
naftaly/Threadcrumb

What's New

1.0.1

2024-02-26T20:00:46Z

Threadcrumb

License Swift Platform

Overview

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

Installation

Threadcrumb can be integrated into your project using Swift Package Manager (SPM) or by directly adding the source files to your Xcode project.

Swift Package Manager

  1. In Xcode, select File > Swift Packages > Add Package Dependency...
  2. Enter the repository URL https://github.com/naftaly/threadcrumb.git.
  3. Specify the version or branch you want to use.
  4. Follow the prompts to complete the integration.

Manual Integration

  1. Download the Threadcrumb source files.
  2. Drag and drop the source files into your Xcode project.
  3. Make sure to add the necessary import statements where you want to use Threadcrumb.

Usage

Creating a Threadcrumb Instance

let threadcrumb = Threadcrumb(identifier: "com.crumb.appstate")

Logging Static Information

threadcrumb.log("appstate_active")

Logging a Formatted Strings

let appstate = "active"
threadcrumb.log("appstate_%@", appstate)

Extracting Logs

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.

Requirements

  • Swift 5.0+
  • iOS 16.0+ / macOS 13.0+ / tvOS 16.0+ / watchOS 9.0+ / visionOS 1.0+

License

Threadcrumb is available under the MIT license. See the LICENSE file for more information.

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sat Oct 19 2024 07:43:45 GMT-0900 (Hawaii-Aleutian Daylight Time)