natinusala/swift-backtrace
This Swift package provides support for automatically printing crash backtraces of Swift programs.
Usage
When building web-services and daemons, direct usage of this library is discouraged. Instead, use swift-service-lifecycle which helps manage the application lifecycle including setting up backtraces hooks when needed.
Add https://github.com/swift-server/swift-backtrace.git as a dependency in your Package.swift.
Crash backtraces
In your main.swift, do:
import Backtrace
// Do this first
Backtrace.install()Finally, for Swift < 5.2, make sure you build your application with debug symbols enabled. Debug symbols are automatically included for Swift 5.2 and above.
$ swift build -c release -Xswiftc -gWhen your app crashes, a stacktrace will be printed to stderr.
Security
Please see SECURITY.md for details on the security process.
Acknowledgements
Ian Partridge (GitHub, Twitter) the original author of this package.
Johannes Weiss (GitHub, Twitter) for the signal handling code.
Package Metadata
Repository: natinusala/swift-backtrace
Default branch: main
README: README.md