[libcalamares] Provide convenience functions for warning and error
This commit is contained in:
parent
79d81700b3
commit
df0d9dcb88
@ -143,7 +143,7 @@ CalamaresApplication::initQmlPath()
|
||||
.absoluteFilePath( subpath ) );
|
||||
if ( !importPath.exists() || !importPath.isReadable() )
|
||||
{
|
||||
cLog() << "FATAL ERROR: explicitly configured application data directory"
|
||||
cError() << "FATAL: explicitly configured application data directory"
|
||||
<< CalamaresUtils::appDataDir().absolutePath()
|
||||
<< "does not contain a valid QML modules directory at"
|
||||
<< importPath.absolutePath()
|
||||
@ -176,7 +176,7 @@ CalamaresApplication::initQmlPath()
|
||||
|
||||
if ( !importPath.exists() || !importPath.isReadable() )
|
||||
{
|
||||
cLog() << "FATAL ERROR: none of the expected QML paths ("
|
||||
cError() << "FATAL: none of the expected QML paths ("
|
||||
<< qmlDirCandidatesByPriority.join( ", " )
|
||||
<< ") exist."
|
||||
<< "\nCowardly refusing to continue startup without the QML directory.";
|
||||
@ -197,7 +197,7 @@ CalamaresApplication::initSettings()
|
||||
settingsFile = QFileInfo( CalamaresUtils::appDataDir().absoluteFilePath( "settings.conf" ) );
|
||||
if ( !settingsFile.exists() || !settingsFile.isReadable() )
|
||||
{
|
||||
cLog() << "FATAL ERROR: explicitly configured application data directory"
|
||||
cError() << "FATAL: explicitly configured application data directory"
|
||||
<< CalamaresUtils::appDataDir().absolutePath()
|
||||
<< "does not contain a valid settings.conf file."
|
||||
<< "\nCowardly refusing to continue startup without settings.";
|
||||
@ -230,7 +230,7 @@ CalamaresApplication::initSettings()
|
||||
|
||||
if ( !settingsFile.exists() || !settingsFile.isReadable() )
|
||||
{
|
||||
cLog() << "FATAL ERROR: none of the expected configuration file paths ("
|
||||
cError() << "FATAL: none of the expected configuration file paths ("
|
||||
<< settingsFileCandidatesByPriority.join( ", " )
|
||||
<< ") contain a valid settings.conf file."
|
||||
<< "\nCowardly refusing to continue startup without settings.";
|
||||
@ -248,7 +248,7 @@ CalamaresApplication::initBranding()
|
||||
QString brandingComponentName = Calamares::Settings::instance()->brandingComponentName();
|
||||
if ( brandingComponentName.simplified().isEmpty() )
|
||||
{
|
||||
cLog() << "FATAL ERROR: branding component not set in settings.conf";
|
||||
cError() << "FATAL: branding component not set in settings.conf";
|
||||
::exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
@ -262,7 +262,7 @@ CalamaresApplication::initBranding()
|
||||
.absoluteFilePath( brandingDescriptorSubpath ) );
|
||||
if ( !brandingFile.exists() || !brandingFile.isReadable() )
|
||||
{
|
||||
cLog() << "FATAL ERROR: explicitly configured application data directory"
|
||||
cError() << "FATAL: explicitly configured application data directory"
|
||||
<< CalamaresUtils::appDataDir().absolutePath()
|
||||
<< "does not contain a valid branding component descriptor at"
|
||||
<< brandingFile.absoluteFilePath()
|
||||
@ -299,7 +299,7 @@ CalamaresApplication::initBranding()
|
||||
|
||||
if ( !brandingFile.exists() || !brandingFile.isReadable() )
|
||||
{
|
||||
cLog() << "FATAL ERROR: none of the expected branding descriptor file paths ("
|
||||
cError() << "FATAL: none of the expected branding descriptor file paths ("
|
||||
<< brandingFileCandidatesByPriority.join( ", " )
|
||||
<< ") contain a valid branding.desc file."
|
||||
<< "\nCowardly refusing to continue startup without branding.";
|
||||
|
@ -223,7 +223,7 @@ Helper::Helper( QObject* parent )
|
||||
}
|
||||
else
|
||||
{
|
||||
cDebug() << "WARNING: creating PythonHelper more than once. This is very bad.";
|
||||
cWarning() << "creating PythonHelper more than once. This is very bad.";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ static CommandLine get_variant_object( const QVariantMap& m )
|
||||
|
||||
if ( !command.isEmpty() )
|
||||
return CommandLine( command, timeout );
|
||||
cDebug() << "WARNING Bad CommandLine element" << m;
|
||||
cWarning() << "Bad CommandLine element" << m;
|
||||
return CommandLine();
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ static CommandList_t get_variant_stringlist( const QVariantList& l )
|
||||
// Otherwise warning is already given
|
||||
}
|
||||
else
|
||||
cDebug() << "WARNING Bad CommandList element" << c << v.type() << v;
|
||||
cWarning() << "Bad CommandList element" << c << v.type() << v;
|
||||
++c;
|
||||
}
|
||||
return retl;
|
||||
@ -79,7 +79,7 @@ CommandList::CommandList::CommandList( const QVariant& v, bool doChroot, int tim
|
||||
if ( v_list.count() )
|
||||
append( get_variant_stringlist( v_list ) );
|
||||
else
|
||||
cDebug() << "WARNING: Empty CommandList";
|
||||
cWarning() << "Empty CommandList";
|
||||
}
|
||||
else if ( v.type() == QVariant::String )
|
||||
append( v.toString() );
|
||||
@ -91,7 +91,7 @@ CommandList::CommandList::CommandList( const QVariant& v, bool doChroot, int tim
|
||||
// Otherwise warning is already given
|
||||
}
|
||||
else
|
||||
cDebug() << "WARNING: CommandList does not understand variant" << v.type();
|
||||
cWarning() << "CommandList does not understand variant" << v.type();
|
||||
}
|
||||
|
||||
CommandList::~CommandList()
|
||||
@ -109,7 +109,7 @@ Calamares::JobResult CommandList::run()
|
||||
{
|
||||
if ( !gs || !gs->contains( "rootMountPoint" ) )
|
||||
{
|
||||
cDebug() << "ERROR: No rootMountPoint defined.";
|
||||
cError() << "No rootMountPoint defined.";
|
||||
return Calamares::JobResult::error( QCoreApplication::translate( "CommandList", "Could not run command." ),
|
||||
QCoreApplication::translate( "CommandList", "No rootMountPoint is defined, so command cannot be run in the target environment." ) );
|
||||
}
|
||||
|
@ -65,5 +65,7 @@ namespace Logger
|
||||
|
||||
#define cLog Logger::CLog
|
||||
#define cDebug Logger::CDebug
|
||||
#define cWarning() Logger::CDebug(Logger::LOGWARNING) << "WARNING:"
|
||||
#define cError() Logger::CDebug(Logger::LOGERROR) << "ERROR:"
|
||||
|
||||
#endif // CALAMARES_LOGGER_H
|
||||
|
Loading…
Reference in New Issue
Block a user