Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/llvm-swift/prettystacktrace
A Swift library for printing a breadcrumb trace on a fatal signal.
https://github.com/llvm-swift/prettystacktrace
Last synced: 4 days ago
JSON representation
A Swift library for printing a breadcrumb trace on a fatal signal.
- Host: GitHub
- URL: https://github.com/llvm-swift/prettystacktrace
- Owner: llvm-swift
- License: mit
- Created: 2018-01-12T00:31:22.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-06-26T21:02:24.000Z (over 5 years ago)
- Last Synced: 2024-10-30T17:16:51.468Z (14 days ago)
- Language: Swift
- Size: 22.5 KB
- Stars: 45
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PrettyStackTrace
PrettyStackTrace allows Swift command-line programs to print a trace of
execution behaviors when a terminating signal is raised, such as a fatal error.To use it, wrap your actions in a call to `trace(_:)`. This will
register an entry in the stack trace and (if your process fatal errors) will
print breadcrumbs to stderr describing what was going on when you crashed.## Installation
PrettyStackTrace is available from the Swift package manager. Add
```swift
.package(url: "https://github.com/llvm-swift/PrettyStackTrace.git", from: "0.0.1")
```to your Package.swift file to use it.
## Example
```swift
trace("doing first task") {
print("I'm doing the first task!")
trace("doing second task") {
print("I'm doing the second task!")
fatalError("error on second task!")
}
}
```This will output:
```
I'm doing the first task!
I'm doing the second task!
Fatal error: error on second task
Stack dump:
-> While doing second task (func main(), in file file.swift, on line 3)
-> While doing first task (func main(), in file file.swift, on line 1)
```## Authors
Harlan Haskins ([@harlanhaskins](https://github.com/harlanhaskins))
Robert Widmann ([@CodaFi](https://github.com/CodaFi))
## License
PrettyStackTrace is released under the MIT license, a copy of which is available
in this repository.