From b68e53513198fbc898467b300bf8e90b61808b31 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 31 May 2021 11:39:13 +0200 Subject: [PATCH] [libcalamares] Log to file and stdout consistently - The log **file** got every QDebug object, while stdout only got the ones of sufficient logging level. A CDebug object checks the logging level before writing anything -- so those already were consistent, but any qDebug() in the program (not cDebug()!) would reach the writing-function anyway, and so log to the file. Fix this weird inconsistency by checking log-level just once, for both writes. --- src/libcalamares/utils/Logger.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/libcalamares/utils/Logger.cpp b/src/libcalamares/utils/Logger.cpp index 8cce91410..c83fea4ae 100644 --- a/src/libcalamares/utils/Logger.cpp +++ b/src/libcalamares/utils/Logger.cpp @@ -69,7 +69,7 @@ logLevel() static void log( const char* msg, unsigned int debugLevel, bool withTime = true ) { - if ( true ) + if ( logLevelEnabled( debugLevel ) ) { QMutexLocker lock( &s_mutex ); @@ -81,11 +81,7 @@ log( const char* msg, unsigned int debugLevel, bool withTime = true ) << QString::number( debugLevel ).toUtf8().data() << "]: " << msg << std::endl; logfile.flush(); - } - if ( logLevelEnabled( debugLevel ) ) - { - QMutexLocker lock( &s_mutex ); if ( withTime ) { std::cout << QTime::currentTime().toString().toUtf8().data() << " ["