Sentry: combine repeated log messages
Should make the breadcrumbs easier to read.
This commit is contained in:
parent
ce65b84c20
commit
685a44ed53
1 changed files with 15 additions and 0 deletions
|
@ -133,9 +133,24 @@ public:
|
||||||
return true;
|
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");
|
flightgear::addSentryBreadcrumb(e.message, (op == SG_WARN) ? "warning" : "error");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string _lastLoggedMessage;
|
||||||
|
int _lastLoggedCount = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
Loading…
Add table
Reference in a new issue