mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-04-09 17:26:15 +00:00
Sentry: add multiple more logging mechanisms, add [CHAT]
This commit is contained in:
@@ -126,6 +126,8 @@ void RegisterThread(const std::string str);
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
void LogChatMessage(const std::string& name, int id, const std::string& msg);
|
||||
|
||||
#define Biggest 30000
|
||||
std::string Comp(std::string Data);
|
||||
std::string DeComp(std::string Compressed);
|
||||
|
||||
@@ -59,10 +59,18 @@ inline void _assert([[maybe_unused]] const char* file, [[maybe_unused]] const ch
|
||||
#define AssertNotReachable() _assert(__FILE__, __func__, __LINE__, "reached unreachable code", false)
|
||||
#else
|
||||
// In release build, these macros turn into NOPs. The compiler will optimize these out.
|
||||
#define Assert(x) \
|
||||
do { \
|
||||
} while (false)
|
||||
#define AssertNotReachable() \
|
||||
do { \
|
||||
} while (false)
|
||||
#define Assert(cond) \
|
||||
do { \
|
||||
if (!result) { \
|
||||
Sentry.LogAssert(#cond, _file_basename, _line, __func__); \
|
||||
}
|
||||
}
|
||||
while (false)
|
||||
#define AssertNotReachable() \
|
||||
do { \
|
||||
if (!result) { \
|
||||
Sentry.LogAssert("code is unreachable", _file_basename, _line, __func__); \
|
||||
}
|
||||
}
|
||||
while (false)
|
||||
#endif // DEBUG
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
|
||||
#include <sentry.h>
|
||||
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
// TODO possibly use attach_stacktrace
|
||||
|
||||
@@ -18,9 +19,9 @@ public:
|
||||
void SetupUser();
|
||||
void Log(sentry_level_t level, const std::string& logger, const std::string& text);
|
||||
void LogError(const std::string& text, const std::string& file, const std::string& line);
|
||||
void SetExtra(const std::string& key, const sentry_value_t& value);
|
||||
void SetExtra(const std::string& key, const std::string& value);
|
||||
void SetContext(const std::string& context_name, const std::unordered_map<std::string, std::string>& map);
|
||||
void LogException(const std::exception& e, const std::string& file, const std::string& line);
|
||||
void LogAssert(const std::string& condition_string, const std::string& file, const std::string& line, const std::string& function);
|
||||
void AddErrorBreadcrumb(const std::string& msg, const std::string& file, const std::string& line);
|
||||
// cleared when Logged
|
||||
void SetTransaction(const std::string& id);
|
||||
@@ -29,6 +30,7 @@ public:
|
||||
private:
|
||||
bool mValid { true };
|
||||
std::mutex mMutex;
|
||||
sentry_value_t mContext;
|
||||
};
|
||||
|
||||
#endif // SENTRY_H
|
||||
|
||||
Reference in New Issue
Block a user