From f0b9120c436a67ea8d977ec4861e4a7ef9de35a8 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Wed, 18 Sep 2013 00:15:46 +1000 Subject: [PATCH] Create a Fatal logging level, and use it when sqlite symbols can't be resolved. --- ext/libclementine-common/core/logging.cpp | 8 +++++++- ext/libclementine-common/core/logging.h | 1 + src/core/database.cpp | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ext/libclementine-common/core/logging.cpp b/ext/libclementine-common/core/logging.cpp index d98a71af5..3c53d7adc 100644 --- a/ext/libclementine-common/core/logging.cpp +++ b/ext/libclementine-common/core/logging.cpp @@ -158,6 +158,7 @@ QDebug CreateLogger(Level level, const QString& class_name, int line) { case Level_Info: level_name = " INFO "; break; case Level_Warning: level_name = " WARN "; break; case Level_Error: level_name = " ERROR "; break; + case Level_Fatal: level_name = " FATAL "; break; } // Check the settings to see if we're meant to show or hide this message. @@ -175,7 +176,12 @@ QDebug CreateLogger(Level level, const QString& class_name, int line) { function_line += ":" + QString::number(line); } - QDebug ret(QtDebugMsg); + QtMsgType type = QtDebugMsg; + if (level == Level_Fatal) { + type = QtFatalMsg; + } + + QDebug ret(type); ret.nospace() << kMessageHandlerMagic << QDateTime::currentDateTime().toString("hh:mm:ss.zzz").toAscii().constData() << level_name << function_line.leftJustified(32).toAscii().constData(); diff --git a/ext/libclementine-common/core/logging.h b/ext/libclementine-common/core/logging.h index d2303c794..3c582cf73 100644 --- a/ext/libclementine-common/core/logging.h +++ b/ext/libclementine-common/core/logging.h @@ -40,6 +40,7 @@ namespace logging { }; enum Level { + Level_Fatal = -1, Level_Error = 0, Level_Warning, Level_Info, diff --git a/src/core/database.cpp b/src/core/database.cpp index 05fe6c3ae..e300bf1c3 100644 --- a/src/core/database.cpp +++ b/src/core/database.cpp @@ -303,7 +303,8 @@ void Database::StaticInit() { !_sqlite3_backup_finish || !_sqlite3_backup_pagecount || !_sqlite3_backup_remaining) { - qLog(Error) << "Couldn't resolve sqlite symbols"; + qLog(Fatal) << "Couldn't resolve sqlite symbols. Please compile " + "Clementine with -DSTATIC_SQLITE=ON."; sLoadedSqliteSymbols = false; } else { sLoadedSqliteSymbols = true;