https://github.com/matis-schotte/tracingactivity
TracingActivity provides Apples Activity Tracing as part of Unified Logging for pure Swift applications.
https://github.com/matis-schotte/tracingactivity
activity-tracing apples-activity-tracing debugging ios macos module package swift tvos unified-logging watchos xcode
Last synced: 3 months ago
JSON representation
TracingActivity provides Apples Activity Tracing as part of Unified Logging for pure Swift applications.
- Host: GitHub
- URL: https://github.com/matis-schotte/tracingactivity
- Owner: matis-schotte
- License: apache-2.0
- Created: 2020-05-30T09:34:38.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-06-06T08:39:36.000Z (almost 5 years ago)
- Last Synced: 2025-01-29T04:02:29.645Z (4 months ago)
- Topics: activity-tracing, apples-activity-tracing, debugging, ios, macos, module, package, swift, tvos, unified-logging, watchos, xcode
- Language: Swift
- Homepage:
- Size: 34.2 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TracingActivity



[](./LICENSE)
[](http://twitter.com/matis_schotte)
TracingActivity provides Apples Activity Tracing as part of Unified Logging for pure Swift applications.
Creation of a tracing activity can fail, but all blocks will always be executed.
The return values will inform if the code was executed inside the activity (success = true) or outside (in case the activity could not be created).
Nesting of activities is encouraged for sub-tasks.## Requirements
- Swift >= 4
- iOS >= 10
- macOS >= 10.12
- tvOS >= 10
- watchOS >= 3.0## Installation
### Swift Package ManagerThe [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler.
Add the Package URL `https://github.com/matis-schotte/TracingActivity.git` in Xcodes project viewer.
Adding it to another Package as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.```swift
dependencies: [
.package(url: "https://github.com/matis-schotte/TracingActivity.git", from: "0.1.0")
]
```## Usage
Block-based activity tracing once:
```swift
_ = TracingActivity.initiate("Activity") {
// ... os_log stuff
}
```
Activity tracing for multiple blocks:
```swift
let activity: TracingActivity? = TracingActivity("Activity")
_ = TracingActivity.apply(activity) {
// ... os_log stuff
}
```
Scope-based activity tracing:
```swift
let activity: TracingActivity? = TracingActivity("Activity2")
var scope = activity?.enter()
// ... os_log stuff
defer {
scope?.leave()
}
```[//]: # (Example: See the example project inside the `examples/` folder.)
## ToDo
- Add SwiftLint (by adding xcodeproj: `swift package generate-xcodeproj`, helps support Xcode Server, too)
- Add Travis CI (without xcodeproj see [reddit](https://www.reddit.com/r/iOSProgramming/comments/d7oyvh/configure_travis_ci_on_github_to_build_ios_swift/), [medium](https://medium.com/@aclaytonscott/creating-and-distributing-swift-packages-132444f5dd1))
- Add codecov
- Add codebeat
- Add codeclimate
- Add codetriage
- Add jazzy docs
- Add CHANGELOG.md
- Clean api docs
- Add Carthage support
- Add Cocoapods support[//]: # (Donations: ETH, LTC welcome.)
## License
TracingActivity is available under the Apache-2.0 license. See the [LICENSE](https://github.com/matis-schotte/TracingActivity/blob/master/LICENSE) file for more info.## Author
Matis Schotte, [[email protected]](mailto:[email protected])[https://github.com/matis-schotte/TracingActivity](https://github.com/matis-schotte/TracingActivity)