diff options
Diffstat (limited to 'src/pulsecore/log.c')
-rw-r--r-- | src/pulsecore/log.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/pulsecore/log.c b/src/pulsecore/log.c index adf2f112..9a7f7cac 100644 --- a/src/pulsecore/log.c +++ b/src/pulsecore/log.c @@ -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); +} |