Replies: 2 comments 4 replies
-
It depends on whether the "similar messages" are log messages before or after formatting. |
Beta Was this translation helpful? Give feedback.
-
I tried implementing this idea and ended up overloading and duplicating many functions. I had to add 2 parameters, "id" and "skip_duration", for all of info, warn, ..., log and sink_it functions. These 2 parameters are then used in a custom filter_similar_sink to keep count of the messages with the same id, and log them only if skip_duration has passed, with the (+x similar messages) message following it. eb2cb46 Is there a better way? |
Beta Was this translation helpful? Give feedback.
-
This idea is similar to the one already suggested here #2064
Basically, if now I have a line like this:
logger->info("test {}", var);
I will find the following lines in my log file:
I would like to be able to pass additional argument what is the minimal time period between two logs of this type:
logger->infoCompressed(5 * 60 /*5 minutes*/, "test {}", var);
And in the log file I will find something like this:
test 1 (+133 similar messages)
and then after five minutes, we get another line like this:
test 31 (+42 similar messages)
What would be the best way to go about implementing this?
Beta Was this translation helpful? Give feedback.
All reactions