aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-04-25 09:12:36 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-04-25 08:43:25 +0000
commite336872828de86146059de0f62ed06afaaf64d8d (patch)
tree46cde212f574ff3f60372137e84cde7e98e5f13c /sources
parenta7038d87ba6ec3b2beeee166930c24f290f6478f (diff)
shiboken: Output module name in "done" message
Move the formatting of the "done" message to the report handler and add the prefix, which is the module name. Change-Id: I63aa1f48f02709d6e89d9a9a684d56a218e65fd3 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources')
-rw-r--r--sources/shiboken2/ApiExtractor/reporthandler.cpp17
-rw-r--r--sources/shiboken2/ApiExtractor/reporthandler.h2
-rw-r--r--sources/shiboken2/generator/main.cpp11
3 files changed, 21 insertions, 9 deletions
diff --git a/sources/shiboken2/ApiExtractor/reporthandler.cpp b/sources/shiboken2/ApiExtractor/reporthandler.cpp
index 36f725e30..6ff5b8d03 100644
--- a/sources/shiboken2/ApiExtractor/reporthandler.cpp
+++ b/sources/shiboken2/ApiExtractor/reporthandler.cpp
@@ -29,6 +29,7 @@
#include "reporthandler.h"
#include "typesystem.h"
#include "typedatabase.h"
+#include <QtCore/QElapsedTimer>
#include <QtCore/QSet>
#include <cstring>
#include <cstdarg>
@@ -56,6 +57,7 @@ static QString m_prefix;
static int m_step_size = 0;
static int m_step = -1;
static int m_step_warning = 0;
+static QElapsedTimer m_timer;
Q_LOGGING_CATEGORY(lcShiboken, "qt.shiboken")
@@ -69,6 +71,7 @@ static void printProgress()
void ReportHandler::install()
{
qInstallMessageHandler(ReportHandler::messageOutput);
+ m_timer.start();
}
ReportHandler::DebugLevel ReportHandler::debugLevel()
@@ -157,3 +160,17 @@ void ReportHandler::progress(const QString& str, ...)
m_step_warning = 0;
}
}
+
+QByteArray ReportHandler::doneMessage()
+{
+ QByteArray result = "Done, " + m_prefix.toUtf8() + ' ';
+ const qint64 elapsed = m_timer.elapsed();
+ result += elapsed > 5000
+ ? QByteArray::number(elapsed / 1000) + 's'
+ : QByteArray::number(elapsed) + "ms";
+ if (m_warningCount)
+ result += ", " + QByteArray::number(m_warningCount) + " warnings";
+ if (m_suppressedCount)
+ result += " (" + QByteArray::number(m_suppressedCount) + " known issues)";
+ return result;
+}
diff --git a/sources/shiboken2/ApiExtractor/reporthandler.h b/sources/shiboken2/ApiExtractor/reporthandler.h
index c122f005d..8f97cb506 100644
--- a/sources/shiboken2/ApiExtractor/reporthandler.h
+++ b/sources/shiboken2/ApiExtractor/reporthandler.h
@@ -66,6 +66,8 @@ public:
static void setPrefix(const QString &p);
+ static QByteArray doneMessage();
+
private:
static void messageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg);
};
diff --git a/sources/shiboken2/generator/main.cpp b/sources/shiboken2/generator/main.cpp
index 1817f6b03..9beaf47c7 100644
--- a/sources/shiboken2/generator/main.cpp
+++ b/sources/shiboken2/generator/main.cpp
@@ -27,7 +27,6 @@
****************************************************************************/
#include <QCoreApplication>
-#include <QElapsedTimer>
#include <QLibrary>
#include <QtCore/QFile>
#include <QtCore/QDir>
@@ -385,8 +384,6 @@ int main(int argc, char *argv[])
// PYSIDE-757: Request a deterministic ordering of QHash in the code model
// and type system.
qSetGlobalQHashSeed(0);
- QElapsedTimer timer;
- timer.start();
// needed by qxmlpatterns
QCoreApplication app(argc, argv);
ReportHandler::install();
@@ -634,12 +631,8 @@ int main(int argc, char *argv[])
}
}
- QByteArray doneMessage = "Done, " + QByteArray::number(timer.elapsed()) + "ms";
- if (const int w = ReportHandler::warningCount())
- doneMessage += ", " + QByteArray::number(w) + " warnings";
- if (const int sw = ReportHandler::suppressedCount())
- doneMessage += " (" + QByteArray::number(sw) + " known issues)";
- qCDebug(lcShiboken()).noquote().nospace() << doneMessage;
+ const QByteArray doneMessage = ReportHandler::doneMessage();
+ qCDebug(lcShiboken, "%s", doneMessage.constData());
std::cout << doneMessage.constData() << std::endl;
return EXIT_SUCCESS;