Ticket #6729: log_count_repeats_24221.patch
File log_count_repeats_24221.patch, 2.6 KB (added by , 14 years ago) |
---|
-
mythtv/libs/libmythtv/avformatdecoder.cpp
109 109 if (VERBOSE_LEVEL_NONE) 110 110 return; 111 111 112 static QString prev_line(""); 113 static int count = 0; 112 114 static QString full_line(""); 113 115 static const int msg_len = 255; 114 116 static QMutex string_lock; … … 157 159 full_line += QString(str); 158 160 if (full_line.endsWith("\n")) 159 161 { 160 full_line.truncate(full_line.length() - 1); 161 VERBOSE(verbose_level, full_line); 162 if (full_line == prev_line) 163 ++count; 164 else 165 { 166 if (count > 0) 167 { 168 // Assume level same for repeated messages 169 snprintf(str, msg_len, 170 " Last message repeated %d times", count); 171 VERBOSE(verbose_level, str); 172 count = 0; 173 } 174 175 prev_line = full_line; 176 177 full_line.truncate(full_line.length() - 1); 178 VERBOSE(verbose_level, full_line); 179 } 180 162 181 full_line.truncate(0); 163 182 } 164 183 string_lock.unlock(); -
mythtv/programs/mythtranscode/mpeg2fix.cpp
58 58 59 59 void my_av_print(void *ptr, int level, const char* fmt, va_list vl) 60 60 { 61 static QString prev_line(""); 62 static int count = 0; 61 63 (void) ptr; 62 64 63 65 static QString full_line(""); 64 char str[256]; 66 static const int msg_len = 255; 67 char str[msg_len + 1]; 65 68 66 69 if (level > AV_LOG_INFO) 67 70 return; … … 70 73 full_line += QString(str); 71 74 if (full_line.endsWith("\n")) 72 75 { 73 full_line.truncate(full_line.length() - 1); 74 VERBOSE(MPF_IMPORTANT, full_line); 75 full_line = QString(""); 76 if (full_line == prev_line) 77 ++count; 78 else 79 { 80 if (count > 0) 81 { 82 // Assume level same for repeated messages 83 snprintf(str, msg_len, 84 " Last message repeated %d times", count); 85 VERBOSE(MPF_IMPORTANT, str); 86 count = 0; 87 } 88 89 prev_line = full_line; 90 91 full_line.truncate(full_line.length() - 1); 92 VERBOSE(MPF_IMPORTANT, full_line); 93 } 94 95 full_line.truncate(0); 76 96 } 77 97 } 78 98