1
0
Fork 0

Sentry: combine repeated log messages

Should make the breadcrumbs easier to read.
This commit is contained in:
James Turner 2020-11-03 17:58:32 +00:00 committed by James Turner
parent ce65b84c20
commit 685a44ed53

View file

@ -133,9 +133,24 @@ public:
return true;
}
if (e.message == _lastLoggedMessage) {
_lastLoggedCount++;
return true;
}
if (_lastLoggedCount > 0) {
flightgear::addSentryBreadcrumb("(repeats " + std::to_string(_lastLoggedCount) + " times)", "info");
_lastLoggedCount = 0;
}
_lastLoggedMessage = e.message;
flightgear::addSentryBreadcrumb(e.message, (op == SG_WARN) ? "warning" : "error");
return true;
}
private:
std::string _lastLoggedMessage;
int _lastLoggedCount = 0;
};
} // namespace