mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 19:05:46 -05:00
[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
2 changed files with 9 additions and 5 deletions
|
@ -174,7 +174,7 @@ System::runCommand(
|
||||||
|
|
||||||
if ( !process.waitForFinished( timeoutSec ? ( timeoutSec * 1000 ) : -1 ) )
|
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();
|
process.readAllStandardOutput();
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ System::runCommand(
|
||||||
|
|
||||||
if ( process.exitStatus() == QProcess::CrashExit )
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ System::runCommand(
|
||||||
if ( ( r != 0 ) || Calamares::Settings::instance()->debugMode() )
|
if ( ( r != 0 ) || Calamares::Settings::instance()->debugMode() )
|
||||||
{
|
{
|
||||||
cDebug() << "Target cmd:" << args;
|
cDebug() << "Target cmd:" << args;
|
||||||
cDebug().noquote() << "Target output:\n" << output;
|
cDebug().noquote().nospace() << "Target output:\n" << output;
|
||||||
}
|
}
|
||||||
return ProcessResult(r, output);
|
return ProcessResult(r, output);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,10 @@ namespace Logger
|
||||||
public:
|
public:
|
||||||
CDebug( unsigned int debugLevel = LOGDEBUG ) : CLog( debugLevel )
|
CDebug( unsigned int debugLevel = LOGDEBUG ) : CLog( debugLevel )
|
||||||
{
|
{
|
||||||
|
if ( debugLevel <= LOGERROR )
|
||||||
|
*this << "ERROR:";
|
||||||
|
else if ( debugLevel <= LOGWARNING )
|
||||||
|
*this << "WARNING:";
|
||||||
}
|
}
|
||||||
virtual ~CDebug();
|
virtual ~CDebug();
|
||||||
};
|
};
|
||||||
|
@ -173,7 +177,7 @@ namespace Logger
|
||||||
}
|
}
|
||||||
|
|
||||||
#define cDebug Logger::CDebug
|
#define cDebug Logger::CDebug
|
||||||
#define cWarning() Logger::CDebug(Logger::LOGWARNING) << "WARNING:"
|
#define cWarning() Logger::CDebug(Logger::LOGWARNING)
|
||||||
#define cError() Logger::CDebug(Logger::LOGERROR) << "ERROR:"
|
#define cError() Logger::CDebug(Logger::LOGERROR)
|
||||||
|
|
||||||
#endif // CALAMARES_LOGGER_H
|
#endif // CALAMARES_LOGGER_H
|
||||||
|
|
Loading…
Add table
Reference in a new issue