mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Events are now removed purely in chronological order if overflowing
This commit is contained in:
@@ -112,8 +112,8 @@ private:
|
||||
// We are exactly full, either because the list was truncated or because we were simply full before
|
||||
if(events.size() == eventLimit - 1) {
|
||||
// If the event is worth adding
|
||||
if(event.getType() != APIEvent::Type::TooManyEvents && event.getSeverity() >= lowestCurrentSeverity()) {
|
||||
discardLeastSevere(1);
|
||||
if(event.getType() != APIEvent::Type::TooManyEvents) {
|
||||
discardOldest(1);
|
||||
events.push_back(event);
|
||||
}
|
||||
|
||||
@@ -126,8 +126,7 @@ private:
|
||||
|
||||
bool enforceLimit(); // Returns whether the limit enforcement resulted in an overflow
|
||||
|
||||
APIEvent::Severity lowestCurrentSeverity() const;
|
||||
void discardLeastSevere(size_t count = 1);
|
||||
void discardOldest(size_t count = 1);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -629,7 +629,7 @@ extern void DLLExport icsneo_discardDeviceEvents(const neodevice_t* device);
|
||||
* If the error limit is reached, an icsneo::APIEvent::TooManyEvents will be flagged.
|
||||
*
|
||||
* If the `newLimit` is smaller than the current error count,
|
||||
* errors will be removed in order of increasing severity and decreasing age.
|
||||
* errors will be removed in order of decreasing age.
|
||||
* This will also flag an icsneo::APIEvent::TooManyEvents.
|
||||
*/
|
||||
extern void DLLExport icsneo_setEventLimit(size_t newLimit);
|
||||
|
||||
Reference in New Issue
Block a user