diff options
| author | Per Larsson <[email protected]> | 2022-01-11 10:30:06 +0100 |
|---|---|---|
| committer | Per Larsson <[email protected]> | 2022-01-11 10:30:06 +0100 |
| commit | df6cc027049089501a6ca9427400277492b8e5a4 (patch) | |
| tree | 9f7e71215074faf2b32e8f83da8c3a8af45fd5d6 /zenserver/zenserver.cpp | |
| parent | Fixed error in if-statement comparison (diff) | |
| download | zen-df6cc027049089501a6ca9427400277492b8e5a4.tar.xz zen-df6cc027049089501a6ca9427400277492b8e5a4.zip | |
Added option to disable Sentry crash handler.
Diffstat (limited to 'zenserver/zenserver.cpp')
| -rw-r--r-- | zenserver/zenserver.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp index 6e5d2fe93..77f7a3d64 100644 --- a/zenserver/zenserver.cpp +++ b/zenserver/zenserver.cpp @@ -154,6 +154,7 @@ public: { using namespace fmt::literals; + m_UseSentry = ServerOptions.NoSentry == false; m_ServerEntry = ServerEntry; m_DebugOptionForcedCrash = ServerOptions.ShouldCrash; const int ParentPid = ServerOptions.OwnerPid; @@ -343,7 +344,11 @@ public: ZEN_INFO(ZEN_APP_NAME " now running (pid: {})", zen::GetCurrentProcessId()); #if USE_SENTRY - sentry_clear_modulecache(); + ZEN_INFO("sentry crash handler {}", m_UseSentry ? "ENABLED" : "DISABLED"); + if (m_UseSentry) + { + sentry_clear_modulecache(); + } #endif if (m_DebugOptionForcedCrash) @@ -549,6 +554,7 @@ private: #endif bool m_DebugOptionForcedCrash = false; + bool m_UseSentry = false; }; void @@ -803,14 +809,15 @@ int ZenEntryPoint::Run() { #if USE_SENTRY - // Initialize sentry.io client - - sentry_options_t* SentryOptions = sentry_options_new(); - sentry_options_set_dsn(SentryOptions, "https://[email protected]/5919284"); - sentry_options_set_database_path(SentryOptions, PathToUtf8(m_ServerOptions.DataDir / ".sentry-native").c_str()); - sentry_init(SentryOptions); + if (m_ServerOptions.NoSentry == false) + { + sentry_options_t* SentryOptions = sentry_options_new(); + sentry_options_set_dsn(SentryOptions, "https://[email protected]/5919284"); + sentry_options_set_database_path(SentryOptions, PathToUtf8(m_ServerOptions.DataDir / ".sentry-native").c_str()); + sentry_init(SentryOptions); - auto _ = zen::MakeGuard([] { sentry_close(); }); + auto _ = zen::MakeGuard([] { sentry_close(); }); + } #endif auto& ServerOptions = m_ServerOptions; |