Logger: Don't discard WARNING or ERROR messages.

When the logger reaches it's threshold for messages, don't discard the
WARNING or ERROR messages up to a certain amount. If THAT threshold
reaches its maximum, start discarding the oldest non-WARNING/ERROR
messages until we only have WARNING and ERROR messages left. Everything
will be discarded after that until we have room again for more.

Also added a test that limits the queue sizes and logs many messages to
see the queues hitting their maximums and discarding the appropriate
messages.

Fixes: #1882
This commit is contained in:
Ben Ford
2026-06-01 11:43:32 -05:00
parent 23b95cc4f7
commit 8680f249b6
3 changed files with 227 additions and 22 deletions
+18
View File
@@ -530,6 +530,24 @@ void ast_logger_set_queue_limit(int queue_limit);
*/
int ast_logger_get_queue_limit(void);
/*!
* \brief Set the threshold for the maximum number of WARNING/ERROR messages allowed in the
* processing queue that can exceed the logger queue's threshold. This acts as a buffer for
* WARNING/ERROR messages so that we can continue to queue them while discarding other message
* types. This threshold sits on top of the logger queue's message threshold, so the actual
* queue size will be the logger queue threshold PLUS this threshold.
*
* \param limit
*/
void ast_logger_set_over_threshold_queue_limit(int limit);
/*!
* \brief Get the over threshold maximum number of messages allowed in the processing queue
*
* \return Over threshold queue limit
*/
int ast_logger_get_over_threshold_queue_limit(void);
/*! \defgroup Scope_Trace Scope Trace
* @{