For Stacked to work, you first need to install the CStack library on the machine that is going to run your project. Please remember to do this on any machine you might deploy your project to:
macOS and Homebrew
Currently the CStack library can be installed through the Vapor tap (by running brew install cstack). If that doesn’t work for some reason or Vapor decides to remove the library from their tap, it can be installed through the Nodes tap by following these steps:
First add the tap:
brew tap nodes-vapor/homebrew-tap
And next, install the library by running:
brew install cstack
Linux and APT
To install CStack on Linux using APT, you first need to setup the Vapor APT repository. The guide for this can be found here. After that, CStack can be installed by doing:
Unfortunately, we’re not able to specify the needed flags for running any project wanting stacktraces through SPM, since it uses a limited set of whitelisted flags. Because of that, you would need to manually add these flags when building your project:
-Xlinker --export-dynamic
Getting started 🚀
First remember to import the module:
import Stacked
Second, call getStackTrace to get a stacktrace that works on both Mac and Linux:
FrameAddress.getStackTrace(maxStackSize: 100)
Which will return you the stacktrace as a [String].
🏆 Credits
This package is developed and maintained by the Vapor team at Nodes.
The package owner for this project is Brett.
📄 License
This package is open-sourced software licensed under the MIT license
Stacked 📚
📦 Installation
Installing CStack
For Stacked to work, you first need to install the CStack library on the machine that is going to run your project. Please remember to do this on any machine you might deploy your project to:
macOS and Homebrew
Currently the CStack library can be installed through the Vapor tap (by running
brew install cstack
). If that doesn’t work for some reason or Vapor decides to remove the library from their tap, it can be installed through the Nodes tap by following these steps:First add the tap:
And next, install the library by running:
Linux and APT
To install CStack on Linux using APT, you first need to setup the Vapor APT repository. The guide for this can be found here. After that, CStack can be installed by doing:
And then:
Integrating
Stacked
in your projectUpdate your
Package.swift
file.Exporting symbols for the stracktraces
Unfortunately, we’re not able to specify the needed flags for running any project wanting stacktraces through SPM, since it uses a limited set of whitelisted flags. Because of that, you would need to manually add these flags when building your project:
Getting started 🚀
First remember to import the module:
Second, call
getStackTrace
to get a stacktrace that works on both Mac and Linux:Which will return you the stacktrace as a
[String]
.🏆 Credits
This package is developed and maintained by the Vapor team at Nodes. The package owner for this project is Brett.
📄 License
This package is open-sourced software licensed under the MIT license