mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-03 08:15:35 +00:00
Clarify what sentry sends, add a way to turn off the warning
This commit is contained in:
parent
38b934bc0f
commit
6542be09ee
@ -31,7 +31,8 @@ public:
|
||||
, MaxCars(1)
|
||||
, DebugModeEnabled(false)
|
||||
, Port(30814)
|
||||
, SendErrors(true) { }
|
||||
, SendErrors(true)
|
||||
, SendErrorsMessageEnabled(true) { }
|
||||
std::string ServerName;
|
||||
std::string ServerDesc;
|
||||
std::string Resource;
|
||||
@ -44,6 +45,7 @@ public:
|
||||
int Port;
|
||||
std::string CustomIP;
|
||||
bool SendErrors;
|
||||
bool SendErrorsMessageEnabled;
|
||||
[[nodiscard]] bool HasCustomIP() const { return !CustomIP.empty(); }
|
||||
};
|
||||
using TShutdownHandler = std::function<void()>;
|
||||
|
@ -19,6 +19,7 @@ static constexpr std::string_view StrDescription = "Description";
|
||||
static constexpr std::string_view StrResourceFolder = "ResourceFolder";
|
||||
static constexpr std::string_view StrAuthKey = "AuthKey";
|
||||
static constexpr std::string_view StrSendErrors = "SendErrors";
|
||||
static constexpr std::string_view StrSendErrorsMessageEnabled = "SendErrorsShowMessage";
|
||||
|
||||
TConfig::TConfig() {
|
||||
if (!fs::exists(ConfigFileName) || !fs::is_regular_file(ConfigFileName)) {
|
||||
@ -35,7 +36,9 @@ TConfig::TConfig() {
|
||||
|
||||
void WriteSendErrors(const std::string& name) {
|
||||
std::ofstream CfgFile { name, std::ios::out | std::ios::app };
|
||||
CfgFile << "# If SendErrors is `true`, the server will send helpful info about crashes and other issues back to the BeamMP developers. This info may include your config, who is on your server at the time of the error, and similar data. You can opt-out of this system by setting this to `false`."
|
||||
CfgFile << "# You can turn on/off the SendErrors message you get on startup here" << std::endl
|
||||
<< StrSendErrorsMessageEnabled << " = true" << std::endl
|
||||
<< "# If SendErrors is `true`, the server will send helpful info about crashes and other issues back to the BeamMP developers. This info may include your config, who is on your server at the time of the error, and similar general information. This kind of data is vital in helping us diagnose and fix issues faster. This has no impact on server performance. You can opt-out of this system by setting this to `false`."
|
||||
<< std::endl
|
||||
<< StrSendErrors << " = true" << std::endl;
|
||||
}
|
||||
@ -150,6 +153,12 @@ void TConfig::ParseFromFile(std::string_view name) {
|
||||
// dont throw, instead write it into the file and use default
|
||||
WriteSendErrors(std::string(name));
|
||||
}
|
||||
if (auto val = GeneralTable[StrSendErrorsMessageEnabled].value<bool>(); val.has_value()) {
|
||||
Application::Settings.SendErrorsMessageEnabled = val.value();
|
||||
} else {
|
||||
// no idea what to do here, ignore...?
|
||||
// this entire toml parser sucks and is replaced in the upcoming lua.
|
||||
}
|
||||
} catch (const std::exception& err) {
|
||||
error("Error parsing config file value: " + std::string(err.what()));
|
||||
mFailed = true;
|
||||
|
@ -36,12 +36,24 @@ void TSentry::PrintWelcome() {
|
||||
if (mValid) {
|
||||
if (!Application::Settings.SendErrors) {
|
||||
mValid = false;
|
||||
if (Application::Settings.SendErrorsMessageEnabled) {
|
||||
info("Opted out of error reporting (SendErrors), Sentry disabled.");
|
||||
} else {
|
||||
info("Sentry started! Reporting errors automatically. You can opt-out of this in the ServerConfig.");
|
||||
info("Sentry disabled");
|
||||
}
|
||||
} else {
|
||||
if (Application::Settings.SendErrorsMessageEnabled) {
|
||||
info("Sentry started! Reporting errors automatically. This sends data to the developers in case of errors and crashes. You can learn more, turn this message off or opt-out of this in the ServerConfig.toml.");
|
||||
} else {
|
||||
info("Sentry started");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (Application::Settings.SendErrorsMessageEnabled) {
|
||||
info("Sentry disabled in unofficial build. Automatic error reporting disabled.");
|
||||
} else {
|
||||
info("Sentry disabled in unofficial build");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user