I am new to Boost.Log and Using it to develop a logger library as a wrapper on top of Boost.Log. My Problem is finding a convenient way to set a counter for number of consecutive repeated log messages instead of printing the same log multiple times.
for example: (ADD_LOG() method is in my library and do BOOST_LOG_SEV(...))
ADD_LOG("Hello");
ADD_LOG("Hello");
ADD_LOG("Hello");
ADD_LOG("Some Different Hello");
I want to be the output log file like this: (sample_0.log)
........................................................
[TimeStamp] [Filter] Hello
[TimeStamp] [Filter] Skipped 2 duplicate messages!
[TimeStamp] [Filter] Some Different Hello
.......................................................
I am using this example with Text File Backend
and TimeStamp
, Filter
are Ok. My problem is about skipping duplicates. maybe with setting filters or anything else.
I think syslog
in linux has this feature by some configurations.