This class provides a simple filter on top of a logger to ensure that the same message is only logged once.
Implementation relies on keeping the history of log messages in a HashMap.
Limitations:
- to limit the memory cost, history size is limited to 32K entries by default, once this limit is reached, no
more messages are sent to the logger
- 32K messages should be a reasonable limit, as long as message formats are similar they should all point to the
same entry in the string cache
- log messages are compared using
hashCode() and equals(), which means that those
methods have better be fast on the arguments passed to the logger (probably not a problem) and that those methods
have better provide a sensible meaning of equals() for our context (which is for example not the case
for an array
Note: if we ever need more than just a
warn() method, we should implement this class as a
Proxy.