[libcalamares] Improve process logging
- Don't insert a space before the output of a process - To do this, suppress space and quoting on the output, and to do that move the labeling-output for warnings and errors into the constructor (so that an idiomatic .nospace() does the right thing).
This commit is contained in:
parent
b5c3fc8cf6
commit
00a5baa3d9
@ -174,7 +174,7 @@ System::runCommand(
|
||||
|
||||
if ( !process.waitForFinished( timeoutSec ? ( timeoutSec * 1000 ) : -1 ) )
|
||||
{
|
||||
cWarning() << "Timed out. Output so far:\n" <<
|
||||
cWarning().noquote().nospace() << "Timed out. Output so far:\n" <<
|
||||
process.readAllStandardOutput();
|
||||
return -4;
|
||||
}
|
||||
@ -183,7 +183,7 @@ System::runCommand(
|
||||
|
||||
if ( process.exitStatus() == QProcess::CrashExit )
|
||||
{
|
||||
cWarning() << "Process crashed. Output so far:\n" << output;
|
||||
cWarning().noquote().nospace() << "Process crashed. Output so far:\n" << output;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -192,7 +192,7 @@ System::runCommand(
|
||||
if ( ( r != 0 ) || Calamares::Settings::instance()->debugMode() )
|
||||
{
|
||||
cDebug() << "Target cmd:" << args;
|
||||
cDebug().noquote() << "Target output:\n" << output;
|
||||
cDebug().noquote().nospace() << "Target output:\n" << output;
|
||||
}
|
||||
return ProcessResult(r, output);
|
||||
}
|
||||
|
@ -56,6 +56,10 @@ namespace Logger
|
||||
public:
|
||||
CDebug( unsigned int debugLevel = LOGDEBUG ) : CLog( debugLevel )
|
||||
{
|
||||
if ( debugLevel <= LOGERROR )
|
||||
*this << "ERROR:";
|
||||
else if ( debugLevel <= LOGWARNING )
|
||||
*this << "WARNING:";
|
||||
}
|
||||
virtual ~CDebug();
|
||||
};
|
||||
@ -173,7 +177,7 @@ namespace Logger
|
||||
}
|
||||
|
||||
#define cDebug Logger::CDebug
|
||||
#define cWarning() Logger::CDebug(Logger::LOGWARNING) << "WARNING:"
|
||||
#define cError() Logger::CDebug(Logger::LOGERROR) << "ERROR:"
|
||||
#define cWarning() Logger::CDebug(Logger::LOGWARNING)
|
||||
#define cError() Logger::CDebug(Logger::LOGERROR)
|
||||
|
||||
#endif // CALAMARES_LOGGER_H
|
||||
|
Loading…
Reference in New Issue
Block a user