diff --git a/src/libcalamares/JobQueue.cpp b/src/libcalamares/JobQueue.cpp index 00b30f318..039a28e26 100644 --- a/src/libcalamares/JobQueue.cpp +++ b/src/libcalamares/JobQueue.cpp @@ -112,17 +112,19 @@ public: QString message; ///< Filled in with errors QString details; + Logger::Once o; m_jobIndex = 0; for ( const auto& jobitem : *m_runningJobs ) { if ( failureEncountered && !jobitem.job->isEmergency() ) { - cDebug() << "Skipping non-emergency job" << jobitem.job->prettyName(); + cDebug() << o << "Skipping non-emergency job" << jobitem.job->prettyName(); } else { - cDebug() << "Starting" << ( failureEncountered ? "EMERGENCY JOB" : "job" ) << jobitem.job->prettyName() + cDebug() << o << "Starting" << ( failureEncountered ? "EMERGENCY JOB" : "job" ) << jobitem.job->prettyName() << '(' << ( m_jobIndex + 1 ) << '/' << m_runningJobs->count() << ')'; + o.refresh(); // So next time it shows the function header again emitProgress( 0.0 ); // 0% for *this job* connect( jobitem.job.data(), &Job::progress, this, &JobThread::emitProgress ); auto result = jobitem.job->exec(); diff --git a/src/libcalamares/modulesystem/Module.cpp b/src/libcalamares/modulesystem/Module.cpp index ff0b20f78..8fbb05300 100644 --- a/src/libcalamares/modulesystem/Module.cpp +++ b/src/libcalamares/modulesystem/Module.cpp @@ -101,7 +101,7 @@ Module::loadConfigurationFile( const QString& configFileName ) //throws YAML::E YAML::Node doc = YAML::Load( ba.constData() ); if ( doc.IsNull() ) { - cDebug() << "Found empty module configuration" << path; + cWarning() << "Found empty module configuration" << path; // Special case: empty config files are valid, // but aren't a map. return; @@ -112,14 +112,13 @@ Module::loadConfigurationFile( const QString& configFileName ) //throws YAML::E return; } - cDebug() << "Loaded module configuration" << path; m_configurationMap = CalamaresUtils::yamlMapToVariant( doc ); m_emergency = m_maybe_emergency && m_configurationMap.contains( EMERGENCY ) && m_configurationMap[ EMERGENCY ].toBool(); return; } } - cDebug() << "No config file for" << name() << "found anywhere at" << Logger::DebugList( configCandidates ); + cWarning() << "No config file for" << name() << "found anywhere at" << Logger::DebugList( configCandidates ); } diff --git a/src/libcalamares/partition/KPMManager.cpp b/src/libcalamares/partition/KPMManager.cpp index 5f6b87589..ff7701703 100644 --- a/src/libcalamares/partition/KPMManager.cpp +++ b/src/libcalamares/partition/KPMManager.cpp @@ -100,12 +100,10 @@ getInternal() KPMManager::KPMManager() : m_d( getInternal() ) { - cDebug() << "KPMManager" << s_backend.use_count() << "created."; } KPMManager::~KPMManager() { - cDebug() << "KPMManager" << s_backend.use_count() << "being destroyed."; } KPMManager::operator bool() const diff --git a/src/libcalamares/utils/CalamaresUtilsSystem.cpp b/src/libcalamares/utils/CalamaresUtilsSystem.cpp index df578a862..d2c0a6cf1 100644 --- a/src/libcalamares/utils/CalamaresUtilsSystem.cpp +++ b/src/libcalamares/utils/CalamaresUtilsSystem.cpp @@ -169,7 +169,7 @@ System::runCommand( System::RunLocation location, } } - cDebug() << "Running" << program << RedactedList( arguments ); + cDebug() << Logger::SubEntry << "Running" << program << RedactedList( arguments ); process.start(); if ( !process.waitForStarted() ) { @@ -208,10 +208,6 @@ System::runCommand( System::RunLocation location, { cDebug() << Logger::SubEntry << "Finished. Exit code:" << r << "output:\n" << Logger::NoQuote << output; } - else - { - cDebug() << Logger::SubEntry << "Finished. Exit code:" << r; - } } else // if ( r != 0 ) { diff --git a/src/libcalamares/utils/Logger.h b/src/libcalamares/utils/Logger.h index 871cc6fb3..1fd534d04 100644 --- a/src/libcalamares/utils/Logger.h +++ b/src/libcalamares/utils/Logger.h @@ -310,6 +310,14 @@ public: } friend CDebug& operator<<( CDebug&&, const Once& ); + /** @brief Restore the object to "fresh" state + * + * It may be necessary to allow the Once object to stream the + * function header again -- for instance, after logging an error, + * any following debug log might want to re-introduce the header. + */ + void refresh() { m = true; } + private: mutable bool m = false; }; diff --git a/src/modules/partition/core/PartUtils.cpp b/src/modules/partition/core/PartUtils.cpp index 54f971f4e..c99884ce6 100644 --- a/src/modules/partition/core/PartUtils.cpp +++ b/src/modules/partition/core/PartUtils.cpp @@ -126,23 +126,22 @@ canBeResized( Partition* candidate, const Logger::Once& o ) return false; } - cDebug() << o << "Checking if" << convenienceName( candidate ) << "can be resized."; if ( !candidate->fileSystem().supportGrow() || !candidate->fileSystem().supportShrink() ) { - cDebug() << Logger::SubEntry << "NO, filesystem" << candidate->fileSystem().name() - << "does not support resize."; + cDebug() << o << "Can not resize" << convenienceName( candidate ) << ", filesystem" + << candidate->fileSystem().name() << "does not support resize."; return false; } if ( isPartitionFreeSpace( candidate ) ) { - cDebug() << Logger::SubEntry << "NO, partition is free space"; + cDebug() << o << "Can not resize" << convenienceName( candidate ) << ", partition is free space"; return false; } if ( candidate->isMounted() ) { - cDebug() << Logger::SubEntry << "NO, partition is mounted"; + cDebug() << o << "Can not resize" << convenienceName( candidate ) << ", partition is mounted"; return false; } @@ -151,14 +150,14 @@ canBeResized( Partition* candidate, const Logger::Once& o ) PartitionTable* table = dynamic_cast< PartitionTable* >( candidate->parent() ); if ( !table ) { - cDebug() << Logger::SubEntry << "NO, no partition table found"; + cDebug() << o << "Can not resize" << convenienceName( candidate ) << ", no partition table found"; return false; } if ( table->numPrimaries() >= table->maxPrimaries() ) { - cDebug() << Logger::SubEntry << "NO, partition table already has" << table->maxPrimaries() - << "primary partitions."; + cDebug() << o << "Can not resize" << convenienceName( candidate ) << ", partition table already has" + << table->maxPrimaries() << "primary partitions."; return false; } } @@ -167,7 +166,8 @@ canBeResized( Partition* candidate, const Logger::Once& o ) double requiredStorageGiB = getRequiredStorageGiB( ok ); if ( !ok ) { - cDebug() << Logger::SubEntry << "NO, requiredStorageGiB is not set correctly."; + cDebug() << o << "Can not resize" << convenienceName( candidate ) + << ", requiredStorageGiB is not set correctly."; return false; } @@ -200,24 +200,25 @@ canBeResized( Partition* candidate, const Logger::Once& o ) bool canBeResized( DeviceModel* dm, const QString& partitionPath, const Logger::Once& o ) { - cDebug() << o << "Checking if" << partitionPath << "can be resized."; - QString partitionWithOs = partitionPath; - if ( partitionWithOs.startsWith( "/dev/" ) ) + if ( partitionPath.startsWith( "/dev/" ) ) { for ( int i = 0; i < dm->rowCount(); ++i ) { Device* dev = dm->deviceForIndex( dm->index( i ) ); - Partition* candidate = CalamaresUtils::Partition::findPartitionByPath( { dev }, partitionWithOs ); + Partition* candidate = CalamaresUtils::Partition::findPartitionByPath( { dev }, partitionPath ); if ( candidate ) { return canBeResized( candidate, o ); } } - cDebug() << Logger::SubEntry << "no Partition* found for" << partitionWithOs; + cWarning() << "Can not resize" << partitionPath << ", no Partition* found."; + return false; + } + else + { + cWarning() << "Can not resize" << partitionPath << ", does not start with /dev"; + return false; } - - cDebug() << Logger::SubEntry << "Partition" << partitionWithOs << "CANNOT BE RESIZED FOR AUTOINSTALL."; - return false; } @@ -250,8 +251,6 @@ lookForFstabEntries( const QString& partitionPath ) { QFile fstabFile( mount.path() + "/etc/fstab" ); - cDebug() << Logger::SubEntry << "reading" << fstabFile.fileName(); - if ( fstabFile.open( QIODevice::ReadOnly | QIODevice::Text ) ) { const QStringList fstabLines = QString::fromLocal8Bit( fstabFile.readAll() ).split( '\n' ); @@ -261,10 +260,11 @@ lookForFstabEntries( const QString& partitionPath ) fstabEntries.append( FstabEntry::fromEtcFstab( rawLine ) ); } fstabFile.close(); - cDebug() << Logger::SubEntry << "got" << fstabEntries.count() << "lines."; + const int lineCount = fstabEntries.count(); std::remove_if( fstabEntries.begin(), fstabEntries.end(), []( const FstabEntry& x ) { return !x.isValid(); } ); - cDebug() << Logger::SubEntry << "got" << fstabEntries.count() << "fstab entries."; + cDebug() << Logger::SubEntry << "got" << fstabEntries.count() << "fstab entries from" << lineCount + << "lines in" << fstabFile.fileName(); } else {