[libcalamares] Drop generic cLog()

- Use cWarning or cError() for errors
 - Use cDebug(level) for other uses (but there aren't any)
This commit is contained in:
Adriaan de Groot 2018-03-28 09:31:45 -04:00
parent ad6227ce21
commit 6bb72d173d
5 changed files with 11 additions and 12 deletions

View File

@ -54,7 +54,7 @@ public:
for( auto job : m_jobs ) for( auto job : m_jobs )
{ {
emitProgress(); emitProgress();
cLog() << "Starting job" << job->prettyName(); cDebug() << "Starting job" << job->prettyName();
connect( job.data(), &Job::progress, this, &JobThread::emitProgress ); connect( job.data(), &Job::progress, this, &JobThread::emitProgress );
JobResult result = job->exec(); JobResult result = job->exec();
if ( !result ) if ( !result )

View File

@ -41,7 +41,7 @@ namespace Logger
class DLLEXPORT CLog : public QDebug class DLLEXPORT CLog : public QDebug
{ {
public: public:
CLog( unsigned int debugLevel = 0 ); explicit CLog( unsigned int debugLevel );
virtual ~CLog(); virtual ~CLog();
private: private:
@ -79,7 +79,6 @@ namespace Logger
DLLEXPORT void setupLogLevel( unsigned int level ); DLLEXPORT void setupLogLevel( unsigned int level );
} }
#define cLog Logger::CLog
#define cDebug Logger::CDebug #define cDebug Logger::CDebug
#define cWarning() Logger::CDebug(Logger::LOGWARNING) << "WARNING:" #define cWarning() Logger::CDebug(Logger::LOGWARNING) << "WARNING:"
#define cError() Logger::CDebug(Logger::LOGERROR) << "ERROR:" #define cError() Logger::CDebug(Logger::LOGERROR) << "ERROR:"

View File

@ -150,9 +150,9 @@ ViewManager::insertViewStep( int before, ViewStep* step )
void void
ViewManager::onInstallationFailed( const QString& message, const QString& details ) ViewManager::onInstallationFailed( const QString& message, const QString& details )
{ {
cLog() << "Installation failed:"; cError() << "Installation failed:";
cLog() << "- message:" << message; cDebug() << "- message:" << message;
cLog() << "- details:" << details; cDebug() << "- details:" << details;
QMessageBox* msgBox = new QMessageBox(); QMessageBox* msgBox = new QMessageBox();
msgBox->setIcon( QMessageBox::Critical ); msgBox->setIcon( QMessageBox::Critical );
@ -167,7 +167,7 @@ ViewManager::onInstallationFailed( const QString& message, const QString& detail
msgBox->setInformativeText( text ); msgBox->setInformativeText( text );
connect( msgBox, &QMessageBox::buttonClicked, qApp, &QApplication::quit ); connect( msgBox, &QMessageBox::buttonClicked, qApp, &QApplication::quit );
cLog() << "Calamares will quit when the dialog closes."; cDebug() << "Calamares will quit when the dialog closes.";
msgBox->show(); msgBox->show();
} }

View File

@ -115,7 +115,7 @@ PartitionModel::parent( const QModelIndex& child ) const
return createIndex( row, 0, parentNode ); return createIndex( row, 0, parentNode );
++row; ++row;
} }
cLog() << "No parent found!"; cWarning() << "No parent found!";
return QModelIndex(); return QModelIndex();
} }

View File

@ -57,21 +57,21 @@ Calamares::JobResult SetHostNameJob::exec()
if ( !gs || !gs->contains( "rootMountPoint" ) ) if ( !gs || !gs->contains( "rootMountPoint" ) )
{ {
cLog() << "No rootMountPoint in global storage"; cError() << "No rootMountPoint in global storage";
return Calamares::JobResult::error( tr( "Internal Error" ) ); return Calamares::JobResult::error( tr( "Internal Error" ) );
} }
QString destDir = gs->value( "rootMountPoint" ).toString(); QString destDir = gs->value( "rootMountPoint" ).toString();
if ( !QDir( destDir ).exists() ) if ( !QDir( destDir ).exists() )
{ {
cLog() << "rootMountPoint points to a dir which does not exist"; cError() << "rootMountPoint points to a dir which does not exist";
return Calamares::JobResult::error( tr( "Internal Error" ) ); return Calamares::JobResult::error( tr( "Internal Error" ) );
} }
QFile hostfile( destDir + "/etc/hostname" ); QFile hostfile( destDir + "/etc/hostname" );
if ( !hostfile.open( QFile::WriteOnly ) ) if ( !hostfile.open( QFile::WriteOnly ) )
{ {
cLog() << "Can't write to hostname file"; cError() << "Can't write to hostname file";
return Calamares::JobResult::error( tr( "Cannot write hostname to target system" ) ); return Calamares::JobResult::error( tr( "Cannot write hostname to target system" ) );
} }
@ -82,7 +82,7 @@ Calamares::JobResult SetHostNameJob::exec()
QFile hostsfile( destDir + "/etc/hosts" ); QFile hostsfile( destDir + "/etc/hosts" );
if ( !hostsfile.open( QFile::WriteOnly ) ) if ( !hostsfile.open( QFile::WriteOnly ) )
{ {
cLog() << "Can't write to hosts file"; cError() << "Can't write to hosts file";
return Calamares::JobResult::error( tr( "Cannot write hostname to target system" ) ); return Calamares::JobResult::error( tr( "Cannot write hostname to target system" ) );
} }