File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ class NUTS_EXPORT Logger : public QObject {
2222 void setLogFile (const QString& path);
2323 void log (LogLevel level, const QString& message);
2424
25+ void debug (const QString& message) { log (LogLevel::Debug, message); }
2526 void info (const QString& message) { log (LogLevel::Info, message); }
2627 void success (const QString& message) { log (LogLevel::Success, message); }
2728 void warning (const QString& message) { log (LogLevel::Warning, message); }
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ struct BackupInfo {
5959};
6060
6161enum class LogLevel {
62+ Debug,
6263 Info,
6364 Success,
6465 Warning,
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ void Logger::openLogFile() {
4141
4242QString Logger::levelToString (LogLevel level) const {
4343 switch (level) {
44+ case LogLevel::Debug: return " Debug" ;
4445 case LogLevel::Info: return " Info" ;
4546 case LogLevel::Success: return " Success" ;
4647 case LogLevel::Warning: return " Warning" ;
@@ -51,6 +52,7 @@ QString Logger::levelToString(LogLevel level) const {
5152
5253QString Logger::levelToColor (LogLevel level) const {
5354 switch (level) {
55+ case LogLevel::Debug: return " \033 [36m" ; // Cyan
5456 case LogLevel::Info: return " \033 [34m" ; // Blue
5557 case LogLevel::Success: return " \033 [32m" ; // Green
5658 case LogLevel::Warning: return " \033 [33m" ; // Yellow
Original file line number Diff line number Diff line change @@ -25,19 +25,31 @@ SystemInterface::SystemInterface(QObject* parent)
2525
2626bool SystemInterface::executeCommand (const QString& program, const QStringList& arguments,
2727 QString& output, QString& error, int timeout) {
28+ // Log the full command being run for troubleshooting
29+ QString cmdLine = program + (arguments.isEmpty () ? QString () : " " + arguments.join (' ' ));
30+ Logger::instance ().debug (" EXEC: " + cmdLine);
31+
2832 QProcess process;
2933 process.start (program, arguments);
3034
3135 if (!process.waitForFinished (timeout)) {
3236 error = " Command timed out" ;
3337 process.kill ();
38+ Logger::instance ().debug (" EXEC TIMEOUT: " + cmdLine);
3439 return false ;
3540 }
3641
3742 output = QString::fromUtf8 (process.readAllStandardOutput ());
3843 error = QString::fromUtf8 (process.readAllStandardError ());
3944
40- return process.exitCode () == 0 ;
45+ int exitCode = process.exitCode ();
46+ if (!output.trimmed ().isEmpty ())
47+ Logger::instance ().debug (" STDOUT: " + output.trimmed ());
48+ if (!error.trimmed ().isEmpty ())
49+ Logger::instance ().debug (" STDERR: " + error.trimmed ());
50+ Logger::instance ().debug (QString (" EXIT(%1): %2" ).arg (exitCode).arg (cmdLine));
51+
52+ return exitCode == 0 ;
4153}
4254
4355SystemInfo SystemInterface::getSystemInfo () {
You can’t perform that action at this time.
0 commit comments