aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/sentryintegration.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2024-08-14 09:23:19 +0200
committerGitHub Enterprise <[email protected]>2024-08-14 09:23:19 +0200
commit501d5e3b0be37ebceda96240af1e4d8df927d68f (patch)
tree1279228466433e992ec1dd2635c317d1ce78dcc3 /src/zenserver/sentryintegration.cpp
parentdon't try to memcache the empty buffer if invalid format (#110) (diff)
downloadzen-501d5e3b0be37ebceda96240af1e4d8df927d68f.tar.xz
zen-501d5e3b0be37ebceda96240af1e4d8df927d68f.zip
improve logging on main failure (#111)
* add support for indenting callstack output * Explicitly catch option-parse error and reduce log spam on bad parameters * add command line to sentry error reports * log command line at startup
Diffstat (limited to 'src/zenserver/sentryintegration.cpp')
-rw-r--r--src/zenserver/sentryintegration.cpp36
1 files changed, 13 insertions, 23 deletions
diff --git a/src/zenserver/sentryintegration.cpp b/src/zenserver/sentryintegration.cpp
index 2f68a269b..5d2b851d1 100644
--- a/src/zenserver/sentryintegration.cpp
+++ b/src/zenserver/sentryintegration.cpp
@@ -190,7 +190,10 @@ SentryIntegration::~SentryIntegration()
}
void
-SentryIntegration::Initialize(std::string SentryDatabasePath, std::string SentryAttachmentPath, bool AllowPII)
+SentryIntegration::Initialize(std::string SentryDatabasePath,
+ std::string SentryAttachmentsPath,
+ bool AllowPII,
+ const std::string& CommandLine)
{
m_AllowPII = AllowPII;
@@ -202,11 +205,11 @@ SentryIntegration::Initialize(std::string SentryDatabasePath, std::string Sentry
sentry_options_set_dsn(SentryOptions, "https://[email protected]/5919284");
sentry_options_set_database_path(SentryOptions, SentryDatabasePath.c_str());
sentry_options_set_logger(SentryOptions, SentryLogFunction, this);
- if (SentryAttachmentPath.starts_with("\\\\?\\"))
+ if (SentryAttachmentsPath.starts_with("\\\\?\\"))
{
- SentryAttachmentPath = SentryAttachmentPath.substr(4);
+ SentryAttachmentsPath = SentryAttachmentsPath.substr(4);
}
- sentry_options_add_attachment(SentryOptions, SentryAttachmentPath.c_str());
+ sentry_options_add_attachment(SentryOptions, SentryAttachmentsPath.c_str());
sentry_options_set_release(SentryOptions, ZEN_CFG_VERSION);
// sentry_options_set_debug(SentryOptions, 1);
@@ -215,6 +218,8 @@ SentryIntegration::Initialize(std::string SentryDatabasePath, std::string Sentry
if (m_SentryErrorCode == 0)
{
+ sentry_value_t SentryUserObject = sentry_value_new_object();
+
if (m_AllowPII)
{
# if ZEN_PLATFORM_WINDOWS
@@ -259,14 +264,15 @@ SentryIntegration::Initialize(std::string SentryDatabasePath, std::string Sentry
m_SentryHostName = "unknown";
}
# endif
- m_SentryId = fmt::format("{}@{}", m_SentryUserName, m_SentryHostName);
- sentry_value_t SentryUserObject = sentry_value_new_object();
+ m_SentryId = fmt::format("{}@{}", m_SentryUserName, m_SentryHostName);
sentry_value_set_by_key(SentryUserObject, "id", sentry_value_new_string(m_SentryId.c_str()));
sentry_value_set_by_key(SentryUserObject, "username", sentry_value_new_string(m_SentryUserName.c_str()));
sentry_value_set_by_key(SentryUserObject, "ip_address", sentry_value_new_string("{{auto}}"));
- sentry_set_user(SentryUserObject);
}
+ sentry_value_set_by_key(SentryUserObject, "cmd", sentry_value_new_string(CommandLine.c_str()));
+ sentry_set_user(SentryUserObject);
+
m_SentryLogger = spdlog::create<sentry::sentry_sink>("sentry");
logging::SetErrorLog("sentry");
@@ -279,22 +285,6 @@ SentryIntegration::Initialize(std::string SentryDatabasePath, std::string Sentry
void
SentryIntegration::LogStartupInformation()
{
-# if (ZEN_PLATFORM_LINUX || ZEN_PLATFORM_MAC)
- uid_t uid = geteuid();
- struct passwd* pw = getpwuid(uid);
- if (pw)
- {
- m_SentryUserName = std::string(pw->pw_name);
- }
- ZEN_INFO("Username: '{}'", m_SentryUserName);
-
- char HostNameBuffer[1023 + 1];
- int err = gethostname(HostNameBuffer, sizeof(HostNameBuffer));
- if (err == 0)
- {
- ZEN_INFO("Hostname: '{}'", HostNameBuffer);
- }
-# endif
if (m_IsInitialized)
{
if (m_SentryErrorCode == 0)