Added Utils::error() and Utils::info() to print to stderr/stdout instead of qDebug()

This commit is contained in:
2019-04-10 18:57:27 +02:00
parent 071bddf28d
commit 6ba1147d11
7 changed files with 48 additions and 20 deletions

View File

@ -21,7 +21,7 @@ int CommandDelete::removeNonExistent(QSqlDatabase &db, bool verbose, bool dryRun
QSqlQuery pathsQuery("SELECT path FROM file", db);
if(!pathsQuery.exec())
{
qDebug() << "Failed to query current paths";
Utils::error() << "Failed to query current paths" << endl;
return 1;
}
@ -44,17 +44,17 @@ int CommandDelete::removeNonExistent(QSqlDatabase &db, bool verbose, bool dryRun
query.addBindValue(path);
if(!query.exec())
{
qDebug() << "Failed to delete " << path << query.lastError();
Utils::error() << "Failed to delete " << path << query.lastError() << endl;
return 1;
}
if(verbose)
{
qInfo() << "Deleted " << path;
Utils::info() << "Deleted " << path << endl;
}
}
else
{
qInfo() << "Would delete " << path;
Utils::info() << "Would delete " << path << endl;
}
}
}
@ -78,19 +78,19 @@ int CommandDelete::removePaths(const QStringList &paths, QSqlDatabase &db, bool
{
if(verbose)
{
qInfo() << "Deleted" << absPath;
Utils::info() << "Deleted" << absPath << endl;
}
}
else
{
qDebug() << "Failed to delete:" << absPath << deletionQuery.lastError();
Utils::error() << "Failed to delete:" << absPath << deletionQuery.lastError() << endl;
result = 1;
}
}
}
else
{
qInfo() << "No such file in database:" << absPath;
Utils::error() << "No such file in database:" << absPath << endl;
result = 1;
}
}