diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-04-25 09:12:36 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-04-25 08:43:25 +0000 |
commit | e336872828de86146059de0f62ed06afaaf64d8d (patch) | |
tree | 46cde212f574ff3f60372137e84cde7e98e5f13c /sources/shiboken2/ApiExtractor | |
parent | a7038d87ba6ec3b2beeee166930c24f290f6478f (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/shiboken2/ApiExtractor')
-rw-r--r-- | sources/shiboken2/ApiExtractor/reporthandler.cpp | 17 | ||||
-rw-r--r-- | sources/shiboken2/ApiExtractor/reporthandler.h | 2 |
2 files changed, 19 insertions, 0 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); }; |