Make logging more consistent.

- Across all the C++ modules, use Logger::SubEntry for sub/continues
   log lines, instead of somewhat-random indent strings.
This commit is contained in:
Adriaan de Groot 2019-04-15 08:59:12 -04:00
parent d6cf0617f6
commit 520478847c
12 changed files with 43 additions and 43 deletions

View File

@ -134,11 +134,11 @@ ResizeFSJob::findPartition( CoreBackend* backend )
cDebug() << "ResizeFSJob found" << ( *dev_it )->deviceNode();
for ( auto part_it = PartitionIterator::begin( *dev_it ); part_it != PartitionIterator::end( *dev_it ); ++part_it )
{
cDebug() << ".." << ( *part_it )->mountPoint() << "on" << ( *part_it )->deviceNode();
cDebug() << Logger::SubEntry << ( *part_it )->mountPoint() << "on" << ( *part_it )->deviceNode();
if ( ( !m_fsname.isEmpty() && ( *part_it )->mountPoint() == m_fsname ) ||
( !m_devicename.isEmpty() && ( *part_it )->deviceNode() == m_devicename ) )
{
cDebug() << ".. matched configuration dev=" << m_devicename << "fs=" << m_fsname;
cDebug() << Logger::SubEntry << "matched configuration dev=" << m_devicename << "fs=" << m_fsname;
return PartitionMatch( *dev_it, *part_it );
}
}
@ -182,13 +182,13 @@ ResizeFSJob::findGrownEnd( ResizeFSJob::PartitionMatch m )
}
if ( ( *part_it )->roles().has( PartitionRole::Unallocated ) )
{
cDebug() << ".. ignoring unallocated" << next_start << '-' << next_end;
cDebug() << Logger::SubEntry << "ignoring unallocated" << next_start << '-' << next_end;
continue;
}
cDebug() << ".. comparing" << next_start << '-' << next_end;
cDebug() << Logger::SubEntry << "comparing" << next_start << '-' << next_end;
if ( ( next_start > last_currently ) && ( next_start < last_available ) )
{
cDebug() << " .. shrunk last available to" << next_start;
cDebug() << Logger::SubEntry << "shrunk last available to" << next_start;
last_available = next_start - 1; // Before that one starts
}
}
@ -205,7 +205,7 @@ ResizeFSJob::findGrownEnd( ResizeFSJob::PartitionMatch m )
qint64 required = m_atleast.apply( m.first );
if ( expand < required )
{
cDebug() << ".. need to expand by" << required << "but only" << expand << "is available.";
cDebug() << Logger::SubEntry << "need to expand by" << required << "but only" << expand << "is available.";
return 0;
}
}
@ -213,7 +213,7 @@ ResizeFSJob::findGrownEnd( ResizeFSJob::PartitionMatch m )
qint64 wanted = m_size.apply( expand, m.first->logicalSize() );
if ( wanted < expand )
{
cDebug() << ".. only growing by" << wanted << "instead of full" << expand;
cDebug() << Logger::SubEntry << "only growing by" << wanted << "instead of full" << expand;
last_available -= ( expand - wanted );
}

View File

@ -254,14 +254,14 @@ KeyboardPage::guessLayout( const QStringList& langParts )
bool foundCountryPart = false;
for ( auto countryPart = langParts.rbegin(); !foundCountryPart && countryPart != langParts.rend(); ++countryPart )
{
cDebug() << " .. looking for locale part" << *countryPart;
cDebug() << Logger::SubEntry << "looking for locale part" << *countryPart;
for ( int i = 0; i < klm->rowCount(); ++i )
{
QModelIndex idx = klm->index( i );
QString name = idx.isValid() ? idx.data( KeyboardLayoutModel::KeyboardLayoutKeyRole ).toString() : QString();
if ( idx.isValid() && ( name.compare( *countryPart, Qt::CaseInsensitive ) == 0 ) )
{
cDebug() << " .. matched" << name;
cDebug() << Logger::SubEntry << "matched" << name;
ui->listLayout->setCurrentIndex( idx );
foundCountryPart = true;
break;
@ -279,7 +279,7 @@ KeyboardPage::guessLayout( const QStringList& langParts )
if ( variantdata && (variantdata->data.compare( *countryPart, Qt::CaseInsensitive ) == 0) )
{
ui->listVariant->setCurrentItem( variantdata );
cDebug() << " .. matched variant" << variantdata->data << ' ' << variantdata->text();
cDebug() << Logger::SubEntry << "matched variant" << variantdata->data << ' ' << variantdata->text();
}
}
}
@ -361,7 +361,7 @@ KeyboardPage::onActivate()
if ( specialCaseMap.contains( lang_s ) )
{
QString newLang = QString::fromStdString( specialCaseMap.value( lang_s ) );
cDebug() << " .. special case language" << lang << "becomes" << newLang;
cDebug() << Logger::SubEntry << "special case language" << lang << "becomes" << newLang;
lang = newLang;
}
}
@ -372,7 +372,7 @@ KeyboardPage::onActivate()
// Note that this his string is not fit for display purposes!
// It doesn't come from QLocale::nativeCountryName.
QString country = QLocale::countryToString( QLocale( lang ).country() );
cDebug() << " .. extracted country" << country << "::" << langParts;
cDebug() << Logger::SubEntry << "extracted country" << country << "::" << langParts;
guessLayout( langParts );
}

View File

@ -66,7 +66,7 @@ QString
SetKeyboardLayoutJob::findConvertedKeymap( const QString& convertedKeymapPath ) const
{
cDebug() << "Looking for converted keymap in" << convertedKeymapPath;
// No search path supplied, assume the distribution does not provide
// converted keymaps
if ( convertedKeymapPath.isEmpty() )
@ -78,7 +78,7 @@ SetKeyboardLayoutJob::findConvertedKeymap( const QString& convertedKeymapPath )
if ( convertedKeymapDir.exists( name + ".map" )
|| convertedKeymapDir.exists( name + ".map.gz" ) )
{
cDebug() << ".. Found converted keymap" << name;
cDebug() << Logger::SubEntry << "Found converted keymap" << name;
return name;
}
@ -90,7 +90,7 @@ QString
SetKeyboardLayoutJob::findLegacyKeymap() const
{
cDebug() << "Looking for legacy keymap in QRC";
int bestMatching = 0;
QString name;
@ -140,7 +140,7 @@ SetKeyboardLayoutJob::findLegacyKeymap() const
// The best matching entry so far, then let's save that
if ( matching >= qMax( bestMatching, 1 ) )
{
cDebug() << ".. Found legacy keymap" << mapping[0]
cDebug() << Logger::SubEntry << "Found legacy keymap" << mapping[0]
<< "with score" << matching;
if ( matching > bestMatching )

View File

@ -95,8 +95,8 @@ void TimeZoneWidget::setCurrentLocation( LocaleGlobal::Location location )
#ifdef DEBUG_TIMEZONES
cDebug() << "Setting location" << location.region << location.zone << location.country;
cDebug() << " .. long" << location.longitude << "lat" << location.latitude;
cDebug() << " .. x" << pos.x() << "y" << pos.y();
cDebug() << Logger::SubEntry << "longitude" << location.longitude << "latitude" << location.latitude;
cDebug() << Logger::SubEntry << "pixel x" << pos.x() << "pixel y" << pos.y();
bool found = false;
#endif
@ -116,10 +116,10 @@ void TimeZoneWidget::setCurrentLocation( LocaleGlobal::Location location )
{
currentZoneImage = zone;
found = true;
cDebug() << " .. First zone found" << i << zone.text( ZONE_NAME );
cDebug() << Logger::SubEntry << "First zone found" << i << zone.text( ZONE_NAME );
}
else
cDebug() << " .. Also in zone" << i << zone.text( ZONE_NAME );
cDebug() << Logger::SubEntry << "Also in zone" << i << zone.text( ZONE_NAME );
#else
currentZoneImage = zone;
break;

View File

@ -81,8 +81,8 @@ NetInstallPage::dataIsHere( QNetworkReply* reply )
if ( reply->error() != QNetworkReply::NoError )
{
cWarning() << "unable to fetch netinstall package lists.";
cDebug() << " ..Netinstall reply error: " << reply->error();
cDebug() << " ..Request for url: " << reply->url().toString() << " failed with: " << reply->errorString();
cDebug() << Logger::SubEntry << "Netinstall reply error: " << reply->error();
cDebug() << Logger::SubEntry << "Request for url: " << reply->url().toString() << " failed with: " << reply->errorString();
ui->netinst_status->setText( tr( "Network Installation. (Disabled: Unable to fetch package lists, check your network connection)" ) );
emit checkReady( !m_required );
return;
@ -91,8 +91,8 @@ NetInstallPage::dataIsHere( QNetworkReply* reply )
if ( !readGroups( reply->readAll() ) )
{
cWarning() << "netinstall groups data was received, but invalid.";
cDebug() << " ..Url: " << reply->url().toString();
cDebug() << " ..Headers: " << reply->rawHeaderList();
cDebug() << Logger::SubEntry << "Url: " << reply->url().toString();
cDebug() << Logger::SubEntry << "Headers: " << reply->rawHeaderList();
ui->netinst_status->setText( tr( "Network Installation. (Disabled: Received invalid groups data)" ) );
reply->deleteLater();
emit checkReady( !m_required );

View File

@ -148,14 +148,14 @@ NetInstallViewStep::onLeave()
QMap<QString, QVariant> op;
op.insert( "install", QVariant( installPackages ) );
packageOperations.append( op );
cDebug() << " .." << installPackages.length() << "critical packages.";
cDebug() << Logger::SubEntry << installPackages.length() << "critical packages.";
}
if ( !tryInstallPackages.empty() )
{
QMap<QString, QVariant> op;
op.insert( "try_install", QVariant( tryInstallPackages ) );
packageOperations.append( op );
cDebug() << " .." << tryInstallPackages.length() << "non-critical packages.";
cDebug() << Logger::SubEntry << tryInstallPackages.length() << "non-critical packages.";
}
if ( !packageOperations.isEmpty() )

View File

@ -236,7 +236,7 @@ lookForFstabEntries( const QString& partitionPath )
{
QFile fstabFile( mountsDir.path() + "/etc/fstab" );
cDebug() << " .. reading" << fstabFile.fileName();
cDebug() << Logger::SubEntry << "reading" << fstabFile.fileName();
if ( fstabFile.open( QIODevice::ReadOnly | QIODevice::Text ) )
{
@ -246,9 +246,9 @@ lookForFstabEntries( const QString& partitionPath )
for ( const QString& rawLine : fstabLines )
fstabEntries.append( FstabEntry::fromEtcFstab( rawLine ) );
fstabFile.close();
cDebug() << " .. got" << fstabEntries.count() << "lines.";
cDebug() << Logger::SubEntry << "got" << fstabEntries.count() << "lines.";
std::remove_if( fstabEntries.begin(), fstabEntries.end(), [](const FstabEntry& x) { return !x.isValid(); } );
cDebug() << " .. got" << fstabEntries.count() << "fstab entries.";
cDebug() << Logger::SubEntry << "got" << fstabEntries.count() << "fstab entries.";
}
else
cWarning() << "Could not read fstab from mounted fs";
@ -408,7 +408,7 @@ bool
isEfiBootable( const Partition* candidate )
{
cDebug() << "Check EFI bootable" << convenienceName( candidate ) << candidate->devicePath();
cDebug() << " .. flags" << candidate->activeFlags();
cDebug() << Logger::SubEntry << "flags" << candidate->activeFlags();
auto flags = PartitionInfo::flags( candidate );
@ -421,7 +421,7 @@ isEfiBootable( const Partition* candidate )
while ( root && !root->isRoot() )
{
root = root->parent();
cDebug() << " .. moved towards root" << (void *)root;
cDebug() << Logger::SubEntry << "moved towards root" << (void *)root;
}
// Strange case: no root found, no partition table node?
@ -429,7 +429,7 @@ isEfiBootable( const Partition* candidate )
return false;
const PartitionTable* table = dynamic_cast<const PartitionTable*>( root );
cDebug() << " .. partition table" << (void *)table << "type" << ( table ? table->type() : PartitionTable::TableType::unknownTableType );
cDebug() << Logger::SubEntry << "partition table" << (void *)table << "type" << ( table ? table->type() : PartitionTable::TableType::unknownTableType );
return table && ( table->type() == PartitionTable::TableType::gpt ) &&
flags.testFlag( KPM_PARTITION_FLAG(Boot) );
}

View File

@ -173,7 +173,7 @@ PartitionCoreModule::doInit()
m_deviceInfos << deviceInfo;
cDebug() << device->deviceNode() << device->capacity() << device->name() << device->prettyName();
}
cDebug() << ".." << devices.count() << "devices detected.";
cDebug() << Logger::SubEntry << devices.count() << "devices detected.";
m_deviceModel->init( devices );
// The following PartUtils::runOsprober call in turn calls PartUtils::canBeResized,
@ -504,11 +504,11 @@ PartitionCoreModule::jobs() const
#ifdef DEBUG_PARTITION_UNSAFE
#ifdef DEBUG_PARTITION_LAME
cDebug() << "Unsafe partitioning is enabled.";
cDebug() << ".. it has been lamed, and will fail.";
cDebug() << Logger::SubEntry << "it has been lamed, and will fail.";
lst << Calamares::job_ptr( new Calamares::FailJob( QStringLiteral( "Partition" ) ) );
#else
cWarning() << "Unsafe partitioning is enabled.";
cWarning() << ".. the unsafe actions will be executed.";
cWarning() << Logger::SubEntry << "the unsafe actions will be executed.";
#endif
#endif

View File

@ -96,7 +96,7 @@ mapForPartition( Partition* partition, const QString& uuid )
// so indent a bit
Logger::CDebug deb;
using TR = Logger::DebugRow<const char *const, const QString&>;
deb << " .. mapping for" << partition->partitionPath() << partition->deviceNode()
deb << Logger::SubEntry << "mapping for" << partition->partitionPath() << partition->deviceNode()
<< TR( "mtpoint:", PartitionInfo::mountPoint( partition ) )
<< TR( "fs:", map[ "fs" ].toString() )
<< TR( "fsname", map[ "fsName" ].toString() )
@ -221,7 +221,7 @@ FillGlobalStorageJob::createPartitionList() const
cDebug() << "Writing to GlobalStorage[\"partitions\"]";
for ( auto device : m_devices )
{
cDebug() << ".. partitions on" << device->deviceNode();
cDebug() << Logger::SubEntry << "partitions on" << device->deviceNode();
for ( auto it = PartitionIterator::begin( device );
it != PartitionIterator::end( device ); ++it )
{

View File

@ -126,7 +126,7 @@ TrackingViewStep::jobs() const
.replace( "$MEMORY", memory )
.replace( "$DISK", disk );
cDebug() << " .. install-tracking URL" << installUrl;
cDebug() << Logger::SubEntry << "install-tracking URL" << installUrl;
l.append( Calamares::job_ptr( new TrackingInstallJob( installUrl ) ) );
}

View File

@ -55,7 +55,7 @@ DEFINE_CHECK_FUNC( minLength )
minLength = value.toInt();
if ( minLength > 0 )
{
cDebug() << " .. minLength set to" << minLength;
cDebug() << Logger::SubEntry << "minLength set to" << minLength;
checks.push_back(
PasswordCheck(
[]()
@ -77,7 +77,7 @@ DEFINE_CHECK_FUNC( maxLength )
maxLength = value.toInt();
if ( maxLength > 0 )
{
cDebug() << " .. maxLength set to" << maxLength;
cDebug() << Logger::SubEntry << "maxLength set to" << maxLength;
checks.push_back(
PasswordCheck(
[]()
@ -94,7 +94,7 @@ DEFINE_CHECK_FUNC( maxLength )
#ifdef HAVE_LIBPWQUALITY
/* NOTE:
*
*
* The munge*() functions are here because libpwquality uses void* to
* represent user-data in callbacks and as a general "pass some parameter"
* type. These need to be munged to the right C++ type.
@ -313,7 +313,7 @@ DEFINE_CHECK_FUNC( libpwquality )
cWarning() << "unrecognized libpwquality setting" << option;
else
{
cDebug() << " .. libpwquality setting" << option;
cDebug() << Logger::SubEntry << "libpwquality setting" << option;
++requirement_count;
}
}

View File

@ -140,7 +140,7 @@ bool matchLocale( QComboBox& list, QLocale& matchFound, std::function<bool(const
if ( predicate(thisLocale) )
{
list.setCurrentIndex( i );
cDebug() << " .. Matched locale " << thisLocale.name();
cDebug() << Logger::SubEntry << "Matched locale " << thisLocale.name();
matchFound = thisLocale;
return true;
}