Output all the working options and their value

At the debug verbose level (-verbose 3) only.
This commit is contained in:
Mozi 2021-02-22 10:05:52 +08:00
parent 7b978a5561
commit 647055ec21
2 changed files with 32 additions and 0 deletions

View File

@ -247,9 +247,34 @@ bool Params::parseParams(const QStringList &paramsArray) {
}
}
printWorkingOptions();
return true;
}
void Params::printWorkingOptions() {
QuasarAppUtils::Params::log("--- Working options table start ---",
QuasarAppUtils::Debug);
QVariantMap::const_iterator iter = params.constBegin();
while (iter != params.constEnd()) {
QString row = QString{"Option[%0]"}.arg(iter.key());
QString value = iter.value().toString();
if (!value.isEmpty()) {
row += QString{": %1"}.arg(value);
}
QuasarAppUtils::Params::log(row, QuasarAppUtils::Debug);
++iter;
}
QuasarAppUtils::Params::log("--- Working options table end ---",
QuasarAppUtils::Debug);
}
QString Params::getStrArg(const QString& key, const QString &def) {
return params.value(key, def).toString();
}

View File

@ -40,6 +40,13 @@ private:
static std::string lvlToString(VerboseLvl vLvl);
static bool writeLoginFile(const QString& log, VerboseLvl vLvl = VerboseLvl::Debug);
/**
* @brief Traverse @a params and output its content (all the working
* options) to stdout in the form of option-value groups at the
* debug verbose level (-verbose 3).
*/
static void printWorkingOptions();
public:
Params() = delete;