From 73a5e0bbcdee5279a5cfde28245be945d93f4d32 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 27 Feb 2018 01:09:43 +0100 Subject: [PATCH] [libcalamares] Fix up debugging Using plain cLog() is weird, it doesn't attach a debugging level so it seems like it's level 0, beyond-critical. --- src/libcalamares/ProcessJob.cpp | 14 ++++++------ .../utils/CalamaresUtilsSystem.cpp | 22 +++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/libcalamares/ProcessJob.cpp b/src/libcalamares/ProcessJob.cpp index 68287097e..55e25254c 100644 --- a/src/libcalamares/ProcessJob.cpp +++ b/src/libcalamares/ProcessJob.cpp @@ -106,16 +106,16 @@ ProcessJob::callOutput( const QString& command, process.setWorkingDirectory( QDir( workingPath ).absolutePath() ); else { - cLog() << "Invalid working directory:" << workingPath; + cWarning() << "Invalid working directory:" << workingPath; return -3; } } - cLog() << "Running" << command; + cDebug() << "Running" << command; process.start(); if ( !process.waitForStarted() ) { - cLog() << "Process failed to start" << process.error(); + cWarning() << "Process failed to start" << process.error(); return -2; } @@ -127,9 +127,9 @@ ProcessJob::callOutput( const QString& command, if ( !process.waitForFinished( timeoutSec ? ( timeoutSec * 1000 ) : -1 ) ) { - cLog() << "Timed out. output so far:"; + cWarning() << "Timed out. output so far:"; output.append( QString::fromLocal8Bit( process.readAllStandardOutput() ).trimmed() ); - cLog() << output; + cWarning() << output; return -4; } @@ -137,11 +137,11 @@ ProcessJob::callOutput( const QString& command, if ( process.exitStatus() == QProcess::CrashExit ) { - cLog() << "Process crashed"; + cWarning() << "Process crashed"; return -1; } - cLog() << "Finished. Exit code:" << process.exitCode(); + cDebug() << "Finished. Exit code:" << process.exitCode(); return process.exitCode(); } diff --git a/src/libcalamares/utils/CalamaresUtilsSystem.cpp b/src/libcalamares/utils/CalamaresUtilsSystem.cpp index 9729386d4..54243553a 100644 --- a/src/libcalamares/utils/CalamaresUtilsSystem.cpp +++ b/src/libcalamares/utils/CalamaresUtilsSystem.cpp @@ -117,7 +117,7 @@ System::runCommand( if ( ( location == System::RunLocation::RunInTarget ) && ( !gs || !gs->contains( "rootMountPoint" ) ) ) { - cLog() << "No rootMountPoint in global storage"; + cWarning() << "No rootMountPoint in global storage"; return -3; } @@ -130,7 +130,7 @@ System::runCommand( QString destDir = gs->value( "rootMountPoint" ).toString(); if ( !QDir( destDir ).exists() ) { - cLog() << "rootMountPoint points to a dir which does not exist"; + cWarning() << "rootMountPoint points to a dir which does not exist"; return -3; } @@ -153,15 +153,15 @@ System::runCommand( if ( QDir( workingPath ).exists() ) process.setWorkingDirectory( QDir( workingPath ).absolutePath() ); else - cLog() << "Invalid working directory:" << workingPath; + cWarning() << "Invalid working directory:" << workingPath; return -3; } - cLog() << "Running" << program << arguments; + cDebug() << "Running" << program << arguments; process.start(); if ( !process.waitForStarted() ) { - cLog() << "Process failed to start" << process.error(); + cWarning() << "Process failed to start" << process.error(); return -2; } @@ -173,8 +173,8 @@ System::runCommand( if ( !process.waitForFinished( timeoutSec ? ( timeoutSec * 1000 ) : -1 ) ) { - cLog() << "Timed out. output so far:"; - cLog() << process.readAllStandardOutput(); + cWarning() << "Timed out. output so far:\n" << + process.readAllStandardOutput(); return -4; } @@ -182,16 +182,16 @@ System::runCommand( if ( process.exitStatus() == QProcess::CrashExit ) { - cLog() << "Process crashed"; + cWarning() << "Process crashed"; return -1; } auto r = process.exitCode(); - cLog() << "Finished. Exit code:" << r; + cDebug() << "Finished. Exit code:" << r; if ( r != 0 ) { - cLog() << "Target cmd:" << args; - cLog().noquote() << "Target output:\n" << output; + cDebug() << "Target cmd:" << args; + cDebug().noquote() << "Target output:\n" << output; } return ProcessResult(r, output); }