]> Devoid-pointer.net GitWeb - anyanka.git/commitdiff
Don't print messages with Logger::Level::DEBUG in release build and deal
authorMichal Malý <madcatxster@devoid-pointer.net>
Tue, 3 Mar 2015 01:10:44 +0000 (02:10 +0100)
committerMichal Malý <madcatxster@devoid-pointer.net>
Tue, 3 Mar 2015 01:10:44 +0000 (02:10 +0100)
with Debug X Release configurations properly in qmakefile.

Anyanka.pro
logger.cpp

index d7ad74ff9dd9c8436caade64030376a15f40603e..a63b9b6d46474aa874ce6b5498819af73d6f63fc 100644 (file)
@@ -20,6 +20,16 @@ win32 {
         INCLUDEPATH += "./"
 }
 
+DEFINES += _HPCS_LITTLE_ENDIAN
+
+CONFIG(debug, debug|release) {
+    DEFINES += ANYANKA_DEBUG
+    message("Debug build")
+} else {
+    DEFINES += NDEBUG
+    message("Release build")
+}
+
 SOURCES += main.cpp\
     datafilesloader.cpp \
     datamanager.cpp \
@@ -98,10 +108,3 @@ FORMS += \
 
 RESOURCES += \
     imgresources.qrc
-
-DEFINES += _HPCS_LITTLE_ENDIAN
-
-CONFIG(release)
-{
-    DEFINES += NDEBUG
-}
index e153eed33b4a4dc4c42123f55e562055a58293b5..b38d9b997d09457a2435152b33c71e7b48c5b660 100644 (file)
@@ -60,6 +60,10 @@ const QString Logger::levelToString(Level level)
 
 void Logger::log(Level level, const QString& sender, const QString& message, bool suppressPrint)
 {
+#ifndef ANYANKA_DEBUG
+  if (level == Logger::Level::DEBUG)
+    return;
+#endif
   LoggedInfo li = std::make_tuple(QDateTime::currentMSecsSinceEpoch(), level, sender, message);
   s_globalInstance->m_lock.lock();
   s_globalInstance->m_logged.push_back(li);