summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Wicking <paul.wicking@qt.io>2020-02-24 10:20:42 +0100
committerPaul Wicking <paul.wicking@qt.io>2020-03-04 10:28:06 +0100
commit9629b11c0b19298663af702dd3801ca31e7c12c3 (patch)
treef3d10d6e59c850def5ff2ebc8209dab8af7e76ea
parent040a420b898f3e768b59875064762c5a89503ccd (diff)
downloadqttools-9629b11c0b19298663af702dd3801ca31e7c12c3.tar.gz
QDoc: Use logging category over logToStdErrAlways
Use the logging category framework for all log messages that used to be issued by logToStdErrAlways. Remove the method so that it doesn't suddenly creep back in. Change-Id: I65131bd01b5c79d6eab9619d9bb9b7bf6ff279c1 Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
-rw-r--r--src/qdoc/clangcodeparser.cpp14
-rw-r--r--src/qdoc/config.cpp2
-rw-r--r--src/qdoc/location.cpp16
-rw-r--r--src/qdoc/location.h1
-rw-r--r--src/qdoc/main.cpp15
5 files changed, 14 insertions, 34 deletions
diff --git a/src/qdoc/clangcodeparser.cpp b/src/qdoc/clangcodeparser.cpp
index 191b423ee..645acc5bd 100644
--- a/src/qdoc/clangcodeparser.cpp
+++ b/src/qdoc/clangcodeparser.cpp
@@ -1281,8 +1281,7 @@ bool ClangCodeParser::getMoreArgs()
of reasonable places to look for include files and use
that list instead.
*/
- Location::logToStdErrAlways(
- "No include paths passed to qdoc; guessing reasonable include paths");
+ qCWarning(lcQdoc) << "No include paths passed to qdoc; guessing reasonable include paths";
guessedIncludePaths = true;
auto forest = qdb_->searchOrder();
@@ -1312,7 +1311,7 @@ void ClangCodeParser::buildPCH()
const QByteArray module = moduleHeader().toUtf8();
QByteArray header;
QByteArray privateHeaderDir;
- Location::logToStdErrAlways("Build & visit PCH for " + moduleHeader());
+ qCInfo(lcQdoc) << "Build & visit PCH for " << moduleHeader();
// A predicate for std::find_if() to locate a path to the module's header
// (e.g. QtGui/QtGui) to be used as pre-compiled header
struct FindPredicate
@@ -1403,8 +1402,7 @@ void ClangCodeParser::buildPCH()
tmpHeaderFile.close();
}
if (printParsingErrors_ == 0)
- Location::logToStdErrAlways(
- "clang not printing errors; include paths were guessed");
+ qCWarning(lcQdoc) << "clang not printing errors; include paths were guessed";
CXErrorCode err =
clang_parseTranslationUnit2(index_, tmpHeader.toLatin1().data(), args_.data(),
static_cast<int>(args_.size()), nullptr, 0,
@@ -1416,7 +1414,7 @@ void ClangCodeParser::buildPCH()
auto error = clang_saveTranslationUnit(tu, pchName_.constData(),
clang_defaultSaveOptions(tu));
if (error) {
- Location::logToStdErrAlways("Could not save PCH file for " + moduleHeader());
+ qCCritical(lcQdoc) << "Could not save PCH file for " << moduleHeader();
pchName_.clear();
} else {
// Visit the header now, as token from pre-compiled header won't be visited
@@ -1424,12 +1422,12 @@ void ClangCodeParser::buildPCH()
CXCursor cur = clang_getTranslationUnitCursor(tu);
ClangVisitor visitor(qdb_, allHeaders_);
visitor.visitChildren(cur);
- Location::logToStdErrAlways("PCH built & visited for " + moduleHeader());
+ qCInfo(lcQdoc) << "PCH built & visited for " << moduleHeader();
}
clang_disposeTranslationUnit(tu);
} else {
pchFileDir_->remove();
- Location::logToStdErrAlways("Could not create PCH file for " + moduleHeader());
+ qCCritical(lcQdoc) << "Could not create PCH file for " << moduleHeader();
}
args_.pop_back(); // remove the "-xc++";
}
diff --git a/src/qdoc/config.cpp b/src/qdoc/config.cpp
index b8cf0f17d..21527f5b5 100644
--- a/src/qdoc/config.cpp
+++ b/src/qdoc/config.cpp
@@ -430,7 +430,7 @@ void Config::setIndexDirs()
[](const QString &s) { return !QFile::exists(s); });
std::for_each(it, m_indexDirs.end(), [](const QString &s) {
- Location::logToStdErrAlways(tr("Cannot find index directory: %1").arg(s));
+ qCWarning(lcQdoc) << "Cannot find index directory: " << s;
});
m_indexDirs.erase(it, m_indexDirs.end());
}
diff --git a/src/qdoc/location.cpp b/src/qdoc/location.cpp
index a77537f56..a76a7327a 100644
--- a/src/qdoc/location.cpp
+++ b/src/qdoc/location.cpp
@@ -370,22 +370,6 @@ void Location::logToStdErr(const QString &message)
}
/*!
- Always prints the current time and \a message to \c stderr
- followed by a \c{'\n'}.
- */
-void Location::logToStdErrAlways(const QString &message)
-{
- if (Generator::useTimestamps()) {
- QTime t = QTime::currentTime();
- fprintf(stderr, "%s LOG: %s\n", t.toString().toLatin1().constData(),
- message.toLatin1().data());
- } else {
- fprintf(stderr, "LOG: %s\n", message.toLatin1().constData());
- }
- fflush(stderr);
-}
-
-/*!
Report a program bug, including the \a hint.
*/
void Location::internalError(const QString &hint)
diff --git a/src/qdoc/location.h b/src/qdoc/location.h
index f6704ca87..242c85067 100644
--- a/src/qdoc/location.h
+++ b/src/qdoc/location.h
@@ -85,7 +85,6 @@ public:
static void information(const QString &message);
static void internalError(const QString &hint);
static void logToStdErr(const QString &message);
- static void logToStdErrAlways(const QString &message);
static void startLoggingProgress() { logProgress_ = true; }
static void stopLoggingProgress() { logProgress_ = false; }
static QString canonicalRelativePath(const QString &path);
diff --git a/src/qdoc/main.cpp b/src/qdoc/main.cpp
index 87a1b4b2d..1105fcf43 100644
--- a/src/qdoc/main.cpp
+++ b/src/qdoc/main.cpp
@@ -160,9 +160,9 @@ static void loadIndexFiles(const QSet<QString> &formats)
// Remove self-dependencies and possible duplicates
config.dependModules().removeAll(config.getString(CONFIG_PROJECT).toLower());
config.dependModules().removeDuplicates();
- Location::logToStdErrAlways(QString("qdocconf file has depends = *;"
- " loading all %1 index files found")
- .arg(config.dependModules().count()));
+ qCCritical(lcQdoc) << "qdocconf file has depends = *; loading all "
+ << config.dependModules().count()
+ << " index files found";
}
for (const auto &module : config.dependModules()) {
QVector<QFileInfo> foundIndices;
@@ -243,7 +243,7 @@ void logStartEndMessage(const QLatin1String &startStop, const Config &config)
+ QLatin1String(" phase)");
const QString msg = startStop + runName;
- Location::logToStdErrAlways(msg);
+ qCInfo(lcQdoc) << msg.data();
}
/*!
@@ -269,8 +269,7 @@ static void processQdocconfFile(const QString &fileName)
config.load(fileName);
QString project = config.getString(CONFIG_PROJECT);
if (project.isEmpty()) {
- Location::logToStdErrAlways(
- QLatin1String("qdoc can't run; no project set in qdocconf file"));
+ qCCritical(lcQdoc) << QLatin1String("qdoc can't run; no project set in qdocconf file");
exit(1);
}
Location::terminate();
@@ -479,7 +478,7 @@ static void processQdocconfFile(const QString &fileName)
add it to the big tree.
*/
parsed = 0;
- Location::logToStdErrAlways("Parse source files for " + project);
+ qCInfo(lcQdoc) << "Parse source files for " << project;
for (const auto &key : sources.keys()) {
auto *codeParser = CodeParser::parserForSourceFile(key);
if (codeParser) {
@@ -488,7 +487,7 @@ static void processQdocconfFile(const QString &fileName)
codeParser->parseSourceFile(config.location(), key);
}
}
- Location::logToStdErrAlways("Source files parsed for " + project);
+ qCInfo(lcQdoc) << "Source files parsed for " << project;
}
/*
Now the primary tree has been built from all the header and