Parcourir la source

[1944] Make sure we print the message ID on abort

When we enable the strict log checking and the excess placeholders check
triggers, we need to print the message to easily identify the message ID
with the problem.
Michal 'vorner' Vaner il y a 13 ans
Parent
commit
f77a1e4539
1 fichiers modifiés avec 7 ajouts et 0 suppressions
  1. 7 0
      src/lib/log/log_formatter.cc

+ 7 - 0
src/lib/log/log_formatter.cc

@@ -17,6 +17,10 @@
 
 #include <cassert>
 
+#ifdef ENABLE_LOGGER_CHECKS
+#include <iostream>
+#endif
+
 using namespace std;
 using namespace boost;
 
@@ -59,6 +63,9 @@ checkExcessPlaceholders(string* message, unsigned int placeholder) {
         // but we can't at least for now because this function is called from
         // the Formatter's destructor.
 #ifdef ENABLE_LOGGER_CHECKS
+        // Also, make sure we print the message so we can identify which
+        // identifier has the problem.
+        cerr << "Message " << *message << endl;
         assert("Excess logger placeholders still exist in message" == NULL);
 #else
         message->append(" @@Excess logger placeholders still exist@@");