mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-31 22:25:33 -04:00
add pa_log_rate_limit()
This commit is contained in:
parent
3dfe70cf78
commit
77c4ccfcaf
2 changed files with 10 additions and 0 deletions
|
|
@ -47,6 +47,7 @@
|
|||
#include <pulsecore/core-util.h>
|
||||
#include <pulsecore/rtclock.h>
|
||||
#include <pulsecore/once.h>
|
||||
#include <pulsecore/ratelimit.h>
|
||||
|
||||
#include "log.h"
|
||||
|
||||
|
|
@ -375,3 +376,10 @@ void pa_log_level(pa_log_level_t level, const char *format, ...) {
|
|||
pa_log_levelv_meta(level, NULL, 0, NULL, format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
pa_bool_t pa_log_ratelimit(void) {
|
||||
/* Not more than 10 messages every 5s */
|
||||
static PA_DEFINE_RATELIMIT(ratelimit, 5 * PA_USEC_PER_SEC, 10);
|
||||
|
||||
return pa_ratelimit_test(&ratelimit);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,4 +109,6 @@ LOG_FUNC(error, PA_LOG_ERROR)
|
|||
|
||||
#define pa_log pa_log_error
|
||||
|
||||
pa_bool_t pa_log_ratelimit(void);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue