Skip to content

Swift no-nonsense dependency-free breadcrumb logger.

License

Notifications You must be signed in to change notification settings

naftaly/Threadcrumb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Swift no-nonsense dependency-free breadcrumb logger.

Resources

License

Stars

Watchers

Forks

Languages