From The Compiler, 7 Years ago, written in Python.
Embed
  1. prevmsg = None
  2. rcnt = 0
  3. for message in error:
  4.         if str(prevmsg) == str(message):
  5.                 rcnt += 1
  6.         elif rcnt != 0:
  7.                 logging.error("=== Previous message repated {} times ===".format(rcnt))
  8.                 rcnt = 0
  9.                 logging.error(message)
  10.         else:
  11.                 logging.error(message)
  12.         prevmsg = message