@@ -210,8 +210,8 @@ class InfoLogger::Impl
210210 } else if (it.first == " verbose" ) {
211211 verbose = atoi (it.second .c_str ());
212212 } else if (it.first == " floodProtection" ) {
213- flood_protection = atoi (it.second .c_str ());
214- } else {
213+ flood_protection = atoi (it.second .c_str ());
214+ } else {
215215 // unknown option
216216 printf (" Unknown infoLogger option %s\n " ,it.first .c_str ());
217217 throw __LINE__;
@@ -247,9 +247,9 @@ class InfoLogger::Impl
247247 }
248248 if (verbose) {
249249 printf (" Using output mode %s\n " , getStringFromMode (currentMode.mode ));
250- if (!flood_protection) {
250+ if (!flood_protection) {
251251 printf (" Flood protection disabled\n " );
252- }
252+ }
253253 }
254254
255255 if (currentMode.mode == OutputMode::file) {
@@ -418,6 +418,7 @@ class InfoLogger::Impl
418418 bool filterDiscardDebug = false ; // when set, messages with debug severity are dropped
419419 int filterDiscardLevel = InfoLogger::undefinedMessageOption.level; // when set, messages with higher level (>=) are dropped
420420 bool filterDiscardFileEnabled = false ; // when set, discarded messages go to file
421+ bool filterDiscardFileIgnoreDebug = false ; // when set, debug messages even when discarded and filterDiscardFileEnabled=true do not go to file
421422 SimpleLog filterDiscardFile; // file object where to save discarded messages
422423
423424 // message flood prevention
@@ -642,6 +643,10 @@ int InfoLogger::Impl::pushMessage(const InfoLoggerMessageOption& options, const
642643 char buffer[LOG_MAX_SIZE];
643644 msgHelper.MessageToText (&msg, buffer, sizeof (buffer), InfoLoggerMessageHelper::Format::Simple);
644645
646+ if (options.severity == InfoLogger::Severity::Debug && filterDiscardFileIgnoreDebug) {
647+ return 1 ;
648+ }
649+
645650 switch (options.severity ) {
646651 case (InfoLogger::Severity::Fatal):
647652 case (InfoLogger::Severity::Error):
@@ -1188,11 +1193,14 @@ void InfoLogger::filterDiscardLevel(int excludeLevel) {
11881193 mPimpl ->filterDiscardLevel = excludeLevel;
11891194}
11901195
1191- int InfoLogger::filterDiscardSetFile (const char *path, unsigned long rotateMaxBytes, unsigned int rotateMaxFiles, unsigned int rotateNow) {
1196+ int InfoLogger::filterDiscardSetFile (const char *path, unsigned long rotateMaxBytes, unsigned int rotateMaxFiles, unsigned int rotateNow, bool ignoreDebug ) {
11921197 mPimpl ->filterDiscardFileEnabled = false ;
11931198 int err = mPimpl ->filterDiscardFile .setLogFile (path, rotateMaxBytes, rotateMaxFiles, rotateNow);
11941199 if (!err && path != nullptr && path[0 ] != ' \0 ' ) {
11951200 mPimpl ->filterDiscardFileEnabled = true ;
1201+ if (ignoreDebug) {
1202+ mPimpl ->filterDiscardFileIgnoreDebug = ignoreDebug;
1203+ }
11961204 }
11971205 return err;
11981206}
0 commit comments