tags:

views:

32

answers:

1

I'm using boost log in my application for logging.

However, in some sections of my code I have some log statements that could occur very often if something goes wrong. I'd want some kind of guard that can limit log messages when it detects that the same log message appears constantly.

e.g. (This is a simplified example, not actual implementation)

while(!framebuffer.try_pop(frame))
{
    BOOST_LOG(trace) << "Buffer underrun.";
}

If for some reason "framebuffer" doesn't receive any frames for a long time the logging will send way to much log messages.

However I'm unsure what strategy to use for limiting log messages, without loosing any important messages, and how to implement it.