mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-02-16 10:41:01 +00:00
Sentry: remove authkey, use id instead
This commit is contained in:
@@ -17,7 +17,7 @@ public:
|
||||
void PrintWelcome();
|
||||
void SetupUser();
|
||||
void Log(sentry_level_t level, const std::string& logger, const std::string& text);
|
||||
void LogDebug(const std::string& text, const std::string& file, const std::string& line);
|
||||
void LogError(const std::string& text, const std::string& file, const std::string& line);
|
||||
void AddExtra(const std::string& key, const sentry_value_t& value);
|
||||
void AddExtra(const std::string& key, const std::string& value);
|
||||
void LogException(const std::exception& e, const std::string& file, const std::string& line);
|
||||
|
||||
@@ -32,7 +32,6 @@ void TSentry::PrintWelcome() {
|
||||
void TSentry::SetupUser() {
|
||||
sentry_value_t user = sentry_value_new_object();
|
||||
sentry_value_set_by_key(user, "id", sentry_value_new_string(Application::Settings.Key.c_str()));
|
||||
sentry_value_set_by_key(user, "authkey", sentry_value_new_string(Application::Settings.Key.c_str()));
|
||||
sentry_set_user(user);
|
||||
}
|
||||
|
||||
@@ -45,9 +44,9 @@ void TSentry::Log(sentry_level_t level, const std::string& logger, const std::st
|
||||
sentry_remove_transaction();
|
||||
}
|
||||
|
||||
void TSentry::LogDebug(const std::string& text, const std::string& file, const std::string& line) {
|
||||
void TSentry::LogError(const std::string& text, const std::string& file, const std::string& line) {
|
||||
SetTransaction(file + ":" + line);
|
||||
Log(SENTRY_LEVEL_DEBUG, "default", file + ": " + text);
|
||||
Log(SENTRY_LEVEL_ERROR, "default", file + ": " + text);
|
||||
}
|
||||
|
||||
void TSentry::AddExtra(const std::string& key, const sentry_value_t& value) {
|
||||
@@ -68,6 +67,7 @@ void TSentry::LogException(const std::exception& e, const std::string& file, con
|
||||
if (!mValid) {
|
||||
return;
|
||||
}
|
||||
SetTransaction(file + ":" + line);
|
||||
Log(SENTRY_LEVEL_ERROR, "exceptions", std::string(e.what()) + " @ " + file + ":" + line);
|
||||
}
|
||||
|
||||
|
||||
@@ -327,13 +327,16 @@ void TServer::Apply(TClient& c, int VID, const std::string& pckt) {
|
||||
Sentry.AddExtra("packet", Packet);
|
||||
Sentry.AddExtra("vehicle-id", std::to_string(VID));
|
||||
Sentry.AddExtra("client-car-count", std::to_string(c.GetCarCount()));
|
||||
Sentry.LogDebug("attempt to apply change to nonexistent vehicle", _file_basename, _line);
|
||||
Sentry.LogError("attempt to apply change to nonexistent vehicle", _file_basename, _line);
|
||||
return;
|
||||
}
|
||||
std::string Header = VD.substr(0, VD.find('{'));
|
||||
|
||||
FoundPos = VD.find('{');
|
||||
if (FoundPos == std::string::npos) {
|
||||
auto Lock = Sentry.CreateExclusiveContext();
|
||||
Sentry.AddExtra("packet", VD);
|
||||
Sentry.LogError("malformed packet", _file_basename, _line);
|
||||
error("Malformed packet received, no '{' found");
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user