aboutsummaryrefslogtreecommitdiff
path: root/zenserver/diag/logging.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-04-25 14:50:29 +0200
committerGitHub <[email protected]>2023-04-25 14:50:29 +0200
commit0d0697cbe19ed2ef385408f72d754cea99c7bc9a (patch)
tree9d05fec6bf2356b56fa432e3e97946adacfc9466 /zenserver/diag/logging.cpp
parent0.2.5 (diff)
downloadzen-0d0697cbe19ed2ef385408f72d754cea99c7bc9a.tar.xz
zen-0d0697cbe19ed2ef385408f72d754cea99c7bc9a.zip
fix sentry report callstack (#256)
* Include file, line and function in sentry log error messages * use sync direct error logger to get correct call stacks on error * changelog * use d1trimfile on windows to shorten file path on windows * constexpr -> consteval
Diffstat (limited to 'zenserver/diag/logging.cpp')
-rw-r--r--zenserver/diag/logging.cpp51
1 files changed, 0 insertions, 51 deletions
diff --git a/zenserver/diag/logging.cpp b/zenserver/diag/logging.cpp
index ca569c467..24c7572f4 100644
--- a/zenserver/diag/logging.cpp
+++ b/zenserver/diag/logging.cpp
@@ -4,15 +4,6 @@
#include "config.h"
-#if !defined(ZEN_USE_SENTRY)
-# if ZEN_PLATFORM_MAC && ZEN_ARCH_ARM64
-// vcpkg's sentry-native port does not support Arm on Mac.
-# define ZEN_USE_SENTRY 0
-# else
-# define ZEN_USE_SENTRY 1
-# endif
-#endif
-
ZEN_THIRD_PARTY_INCLUDES_START
#include <spdlog/async.h>
#include <spdlog/async_logger.h>
@@ -23,9 +14,6 @@ ZEN_THIRD_PARTY_INCLUDES_START
#include <spdlog/sinks/msvc_sink.h>
#include <spdlog/sinks/rotating_file_sink.h>
#include <spdlog/sinks/stdout_color_sinks.h>
-#if ZEN_USE_SENTRY
-# include <sentry.h>
-#endif
ZEN_THIRD_PARTY_INCLUDES_END
#include <zencore/compactbinary.h>
@@ -356,38 +344,6 @@ EnableVTMode()
} // namespace logging
-#if ZEN_USE_SENTRY
-
-class sentry_sink final : public spdlog::sinks::base_sink<spdlog::details::null_mutex>
-{
-public:
- sentry_sink() {}
-
-protected:
- static constexpr sentry_level_t MapToSentryLevel[spdlog::level::level_enum::n_levels] = {SENTRY_LEVEL_DEBUG,
- SENTRY_LEVEL_DEBUG,
- SENTRY_LEVEL_INFO,
- SENTRY_LEVEL_WARNING,
- SENTRY_LEVEL_ERROR,
- SENTRY_LEVEL_FATAL,
- SENTRY_LEVEL_DEBUG};
-
- void sink_it_(const spdlog::details::log_msg& msg) override
- {
- if (msg.level >= SPDLOG_LEVEL_ERROR && msg.level <= SPDLOG_LEVEL_CRITICAL)
- {
- sentry_value_t event = sentry_value_new_message_event(
- /* level */ MapToSentryLevel[msg.level],
- /* logger */ nullptr,
- /* message */ std::string(msg.payload.data(), msg.payload.size()).c_str());
- sentry_event_value_add_stacktrace(event, NULL, 0);
- sentry_capture_event(event);
- }
- }
- void flush_() override {}
-};
-#endif
-
void
InitializeLogging(const ZenServerOptions& GlobalOptions)
{
@@ -439,10 +395,6 @@ InitializeLogging(const ZenServerOptions& GlobalOptions)
/* rotate on open */ true);
#endif
-#if ZEN_USE_SENTRY
- auto SentrySink = std::make_shared<sentry_sink>();
-#endif
-
std::set_terminate([]() { ZEN_CRITICAL("Program exited abnormally via std::terminate()"); });
// Default
@@ -453,9 +405,6 @@ InitializeLogging(const ZenServerOptions& GlobalOptions)
Sinks.clear();
Sinks.push_back(ConsoleSink);
Sinks.push_back(FileSink);
-#if ZEN_USE_SENTRY
- Sinks.push_back(SentrySink);
-#endif
#if ZEN_PLATFORM_WINDOWS
if (zen::IsDebuggerPresent() && GlobalOptions.IsDebug)