[libcalamares][partition] Give RedactedName a convert-to-QString
- use hex-trailer - while here, convert DebugRow to use a copy rather than a reference, to avoid dangling references when applied to temporaries - convert *partition* module to use the RedactedNames
This commit is contained in:
parent
152b3c333b
commit
5a4e2b73ab
@ -278,10 +278,9 @@ RedactedName::RedactedName(const char *context, const QString& s )
|
||||
{
|
||||
}
|
||||
|
||||
QDebug&
|
||||
operator<< ( QDebug& s, const RedactedName& n )
|
||||
RedactedName::operator QString() const
|
||||
{
|
||||
return s << NoQuote << n.m_context << '$' << n.m_id << Quote;
|
||||
return QString( m_context + '$' + QString::number( m_id, 16 ) );
|
||||
}
|
||||
|
||||
} // namespace Logger
|
||||
|
@ -145,8 +145,8 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
const T& first;
|
||||
const U& second;
|
||||
const T first;
|
||||
const U second;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -237,11 +237,17 @@ struct RedactedName
|
||||
RedactedName( const char* context, const QString& s );
|
||||
RedactedName( const QString& context, const QString& s );
|
||||
|
||||
operator QString() const;
|
||||
|
||||
private:
|
||||
const uint m_id;
|
||||
const QString m_context;
|
||||
};
|
||||
|
||||
QDebug& operator<<( QDebug& s, const RedactedName& n );
|
||||
inline QDebug& operator<<( QDebug& s, const RedactedName& n )
|
||||
{
|
||||
return s << NoQuote << QString( n ) << Quote;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Formatted logging of a pointer
|
||||
|
@ -262,8 +262,11 @@ PartitionCoreModule::doInit()
|
||||
// Gives ownership of the Device* to the DeviceInfo object
|
||||
auto deviceInfo = new DeviceInfo( device );
|
||||
m_deviceInfos << deviceInfo;
|
||||
cDebug() << Logger::SubEntry << device->deviceNode() << device->capacity() << device->name()
|
||||
<< device->prettyName();
|
||||
cDebug() << Logger::SubEntry
|
||||
<< device->deviceNode()
|
||||
<< device->capacity()
|
||||
<< Logger::RedactedName( "DevName", device->name() )
|
||||
<< Logger::RedactedName( "DevNamePretty", device->prettyName() );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -104,17 +104,17 @@ mapForPartition( Partition* partition, const QString& uuid )
|
||||
// Debugging for inside the loop in createPartitionList(),
|
||||
// so indent a bit
|
||||
Logger::CDebug deb;
|
||||
using TR = Logger::DebugRow< const char* const, const QString& >;
|
||||
using TR = Logger::DebugRow< const char* const, const QString >;
|
||||
// clang-format off
|
||||
deb << Logger::SubEntry << "mapping for" << partition->partitionPath() << partition->deviceNode()
|
||||
<< TR( "partlabel", map[ "partlabel" ].toString() )
|
||||
<< TR( "partition-uuid (partuuid)", map[ "partuuid" ].toString() )
|
||||
<< TR( "partition-uuid (partuuid)", Logger::RedactedName( "PartUUID", map[ "partuuid" ].toString() ) )
|
||||
<< TR( "parttype", map[ "parttype" ].toString() )
|
||||
<< TR( "partattrs", map[ "partattrs" ].toString() )
|
||||
<< TR( "mountPoint:", PartitionInfo::mountPoint( partition ) )
|
||||
<< TR( "fs:", map[ "fs" ].toString() )
|
||||
<< TR( "fsName", map[ "fsName" ].toString() )
|
||||
<< TR( "filesystem-uuid (uuid)", uuid )
|
||||
<< TR( "filesystem-uuid (uuid)", Logger::RedactedName( "FSUUID", uuid ) )
|
||||
<< TR( "claimed", map[ "claimed" ].toString() );
|
||||
// clang-format on
|
||||
if ( partition->roles().has( PartitionRole::Luks ) )
|
||||
|
Loading…
Reference in New Issue
Block a user