Sentry experiment: record warnings/alerts
This means that when a crash/exception occurs, we can see the preceding warnings and alerts. Not sure if this will really help, so giving it a test.
This commit is contained in:
parent
d56e3857b6
commit
5329c4024b
1 changed files with 28 additions and 0 deletions
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include "sentryIntegration.hxx"
|
#include "sentryIntegration.hxx"
|
||||||
|
|
||||||
|
#include <simgear/debug/LogCallback.hxx>
|
||||||
#include <simgear/debug/logstream.hxx>
|
#include <simgear/debug/logstream.hxx>
|
||||||
#include <simgear/misc/sg_path.hxx>
|
#include <simgear/misc/sg_path.hxx>
|
||||||
#include <simgear/props/props.hxx>
|
#include <simgear/props/props.hxx>
|
||||||
|
@ -40,6 +41,31 @@ static bool static_sentryEnabled = false;
|
||||||
|
|
||||||
#include <sentry.h>
|
#include <sentry.h>
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
class SentryLogCallback : public simgear::LogCallback
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SentryLogCallback() : simgear::LogCallback(SG_ALL, SG_WARN)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool doProcessEntry(const simgear::LogEntry& e) override
|
||||||
|
{
|
||||||
|
// we need original priority here, so we don't record MANDATORY_INFO
|
||||||
|
// or DEV_ messages, which would get noisy.
|
||||||
|
const auto op = e.originalPriority;
|
||||||
|
if ((op != SG_WARN) && (op != SG_ALERT)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
flightgear::addSentryBreadcrumb(e.message, (op == SG_WARN) ? "warning" : "error");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
namespace flightgear
|
namespace flightgear
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -100,6 +126,8 @@ void initSentry()
|
||||||
|
|
||||||
sentry_init(options);
|
sentry_init(options);
|
||||||
static_sentryEnabled = true;
|
static_sentryEnabled = true;
|
||||||
|
|
||||||
|
sglog().addCallback(new SentryLogCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
void delayedSentryInit()
|
void delayedSentryInit()
|
||||||
|
|
Loading…
Reference in a new issue