Skip to content

Commit c98aa3a

Browse files
committed
fix: add stacktrace include
1 parent ba4c664 commit c98aa3a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/module.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
#include <plugify/numerics.hpp>
1414
#include <plugify/any.hpp>
1515

16+
#if PLUGIFY_STACKTRACE_SUPPORT
17+
#include <stacktrace>
18+
#else
1619
#include <cpptrace/cpptrace.hpp>
20+
#endif
1721

1822
#if GOLM_PLATFORM_WINDOWS
1923
#include <windows.h>
@@ -216,9 +220,14 @@ void PrintException(GoString message) {
216220
if (const auto& provider = g_golm.GetProvider()) {
217221
provider->Log(std::format(LOG_PREFIX "[Exception] {}", std::string_view(message)), Severity::Error);
218222

223+
#if PLUGIFY_STACKTRACE_SUPPORT
224+
auto trace = std::stacktrace::current();
225+
provider->Log(std::to_string(trace), Severity::Error);
226+
#else
219227
std::stringstream stream;
220228
cpptrace::generate_trace().print(stream);
221229
provider->Log(stream.str(), Severity::Error);
230+
#endif
222231
}
223232
}
224233

0 commit comments

Comments
 (0)