Index: main/logger.c =================================================================== --- main/logger.c (revision 223322) +++ main/logger.c (working copy) @@ -134,6 +134,10 @@ COLOR_BRGREEN }; +__thread char lastmsg[4096] = ""; +__thread int lastmsg_count = 0; +#define LOG_SUPPRESS_IDENTICAL_MESSAGES 30 + AST_THREADSTORAGE(verbose_buf, verbose_buf_init); #define VERBOSE_BUF_INIT_SIZE 128 @@ -726,6 +730,21 @@ /* Ignore anything other than the currently debugged file if there is one */ if ((level == __LOG_DEBUG) && !ast_strlen_zero(debug_filename) && strcasecmp(debug_filename, file)) return; + + if (!strcasecmp(fmt,lastmsg)) { + lastmsg_count++; + if (lastmsg_count>LOG_SUPPRESS_IDENTICAL_MESSAGES) { + return; + } + } else { + if (lastmsg_count>LOG_SUPPRESS_IDENTICAL_MESSAGES) { + int repeats = lastmsg_count-LOG_SUPPRESS_IDENTICAL_MESSAGES; + lastmsg_count=0; + ast_log(level, file, line, function, "Message repeats %d times\n", repeats); + } + lastmsg_count=0; + ast_copy_string(lastmsg, fmt, sizeof(lastmsg)); + } time(&t); ast_localtime(&t, &tm, NULL);