From 716328cafb95a8f879bf975ee95a3821af206d51 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 31 May 2021 11:26:49 +0200 Subject: [PATCH] [libcalamares] Un-clog Logging - Map QtMsgType -- used by qDebug() and qWarning() -- to levels used by Calamares in a consistent fashion. - Drop unused log levels (INFO, EXTRA unused in any Calamares code). --- src/libcalamares/utils/Logger.cpp | 17 +++++++++-------- src/libcalamares/utils/Logger.h | 2 -- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/libcalamares/utils/Logger.cpp b/src/libcalamares/utils/Logger.cpp index 262ff59e1..8cce91410 100644 --- a/src/libcalamares/utils/Logger.cpp +++ b/src/libcalamares/utils/Logger.cpp @@ -33,7 +33,7 @@ static unsigned int s_threshold = #ifdef QT_NO_DEBUG Logger::LOG_DISABLE; #else - Logger::LOGEXTRA + 1; // Comparison is < in log() function + Logger::LOGDEBUG; // Comparison is < in log() function #endif static QMutex s_mutex; @@ -105,20 +105,21 @@ CalamaresLogHandler( QtMsgType type, const QMessageLogContext&, const QString& m const char* message = ba.constData(); QMutexLocker locker( &s_mutex ); + switch ( type ) { - case QtDebugMsg: + case QtInfoMsg: log( message, LOGVERBOSE ); break; - - case QtInfoMsg: - log( message, 1 ); + case QtDebugMsg: + log( message, LOGDEBUG ); break; - - case QtCriticalMsg: case QtWarningMsg: + log( message, LOGWARNING ); + break; + case QtCriticalMsg: case QtFatalMsg: - log( message, 0 ); + log( message, LOGERROR ); break; } } diff --git a/src/libcalamares/utils/Logger.h b/src/libcalamares/utils/Logger.h index b2e8cf0e8..6736ba740 100644 --- a/src/libcalamares/utils/Logger.h +++ b/src/libcalamares/utils/Logger.h @@ -47,8 +47,6 @@ enum LOG_DISABLE = 0, LOGERROR = 1, LOGWARNING = 2, - LOGINFO = 3, - LOGEXTRA = 5, LOGDEBUG = 6, LOGVERBOSE = 8 };