summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Wicking <paul.wicking@qt.io>2019-08-09 13:46:08 +0200
committerPaul Wicking <paul.wicking@qt.io>2020-01-30 13:00:20 +0100
commit1639c9a80490fc56c2bb1438dfa0d84455be55ed (patch)
treedb4bb2df71fda22d9461a8ba0e9a66944cdb12d9
parent01dbe9a348f09cfefc927d1de96d82afbd09f995 (diff)
downloadqttools-1639c9a80490fc56c2bb1438dfa0d84455be55ed.tar.gz
QDoc: Move logging to helper method
Change-Id: I39d10454442178e6f1292d136eea8ee990ad162f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
-rw-r--r--src/qdoc/main.cpp37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/qdoc/main.cpp b/src/qdoc/main.cpp
index 2b2b7a6f8..79cb471ce 100644
--- a/src/qdoc/main.cpp
+++ b/src/qdoc/main.cpp
@@ -224,6 +224,27 @@ static void loadIndexFiles(Config &config, const QSet<QString> &formats)
}
/*!
+ \internal
+ Prints to stderr the name of the project that QDoc is running for,
+ in which mode and which phase.
+
+ If QDoc is running in debug mode, also logs the command line arguments.
+ */
+void logStartEndMessage(const QLatin1String &startStop, const Config &config)
+{
+ const QString runName = " qdoc for "
+ + config.getString(CONFIG_PROJECT)
+ + QLatin1String(" in ")
+ + QLatin1String(Generator::singleExec() ? "single" : "dual")
+ + QLatin1String(" process mode, (")
+ + QLatin1String(Generator::preparing() ? "prepare" : "generate")
+ + QLatin1String(" phase)");
+
+ const QString msg = startStop + runName;
+ Location::logToStdErrAlways(msg);
+}
+
+/*!
Processes the qdoc config file \a fileName. This is the controller for all
of QDoc. The \a config instance represents the configuration data for QDoc.
All other classes are initialized with the same config.
@@ -255,22 +276,13 @@ static void processQdocconfFile(const QString &fileName, Config &config)
if (!config.currentDir().isEmpty())
QDir::setCurrent(config.currentDir());
- QString phase = " in ";
- if (Generator::singleExec())
- phase += "single process mode, ";
- else
- phase += "dual process mode, ";
- if (Generator::preparing())
- phase += "(prepare phase)";
- else if (Generator::generating())
- phase += "(generate phase)";
+ logStartEndMessage(QLatin1String("Start"), config);
- QString msg = "Start qdoc for " + config.getString(CONFIG_PROJECT) + phase;
- Location::logToStdErrAlways(msg);
if (config.getDebug()) {
Utilities::startDebugging(QString("command line"));
qCDebug(lcQdoc).noquote() << "Arguments:" << QCoreApplication::arguments();
}
+
/*
Initialize all the classes and data structures with the
qdoc configuration. This is safe to do for each qdocconf
@@ -505,8 +517,7 @@ static void processQdocconfFile(const QString &fileName, Config &config)
if (Utilities::debugging())
Utilities::stopDebugging(project);
- msg = "End qdoc for " + config.getString(CONFIG_PROJECT) + phase;
- Location::logToStdErrAlways(msg);
+ logStartEndMessage(QLatin1String("End"), config);
QDocDatabase::qdocDB()->setVersion(QString());
Generator::terminate();
CodeParser::terminate();