diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2016-09-08 15:29:30 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2016-09-30 09:12:42 +0000 |
commit | 96b501d80e539a832ef9f2bef4f34162eb8ad3e2 (patch) | |
tree | 4b5c54efa27a0a50ee4e874334671e0856593227 /src/lib/corelib/logging | |
parent | bf3a7979a41b166b8dc178a3cc6a22f15a4e6ea5 (diff) |
Re-display warnings when loading a stored build graph
[ChangeLog] Warnings encountered during project resolving are now stored
and will be re-displayed when the project is loaded.
Task-number: QBS-1011
Change-Id: I5fa04d3d537866212abbdf739b09a254843de473
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Diffstat (limited to 'src/lib/corelib/logging')
-rw-r--r-- | src/lib/corelib/logging/logger.cpp | 7 | ||||
-rw-r--r-- | src/lib/corelib/logging/logger.h | 10 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/lib/corelib/logging/logger.cpp b/src/lib/corelib/logging/logger.cpp index 0d397e36d..866ad8b00 100644 --- a/src/lib/corelib/logging/logger.cpp +++ b/src/lib/corelib/logging/logger.cpp @@ -213,6 +213,13 @@ bool Logger::traceEnabled() const return m_logSink->willPrint(LoggerTrace); } +void Logger::printWarning(const ErrorInfo &warning) +{ + if (m_storeWarnings) + m_warnings << warning; + logSink()->printWarning(warning); +} + LogWriter Logger::qbsLog(LoggerLevel level, bool force) const { return LogWriter(m_logSink, level, force); diff --git a/src/lib/corelib/logging/logger.h b/src/lib/corelib/logging/logger.h index 23884dfba..2e3edc880 100644 --- a/src/lib/corelib/logging/logger.h +++ b/src/lib/corelib/logging/logger.h @@ -42,6 +42,8 @@ #include "ilogsink.h" +#include <tools/error.h> + #include <QByteArray> #include <QString> #include <QStringList> @@ -104,6 +106,7 @@ QBS_EXPORT LogWriter operator<<(LogWriter w, qint64 n); QBS_EXPORT LogWriter operator<<(LogWriter w, bool b); QBS_EXPORT LogWriter operator<<(LogWriter w, const MessageTag &tag); + class QBS_EXPORT Logger { public: @@ -114,7 +117,10 @@ public: bool debugEnabled() const; bool traceEnabled() const; - void printWarning(const ErrorInfo &warning) { logSink()->printWarning(warning); } + void printWarning(const ErrorInfo &warning); + QList<ErrorInfo> warnings() const { return m_warnings; } + void clearWarnings() { m_warnings.clear(); } + void storeWarnings() { m_storeWarnings = true; } LogWriter qbsLog(LoggerLevel level, bool force = false) const; LogWriter qbsWarning() const { return qbsLog(LoggerWarning); } @@ -124,6 +130,8 @@ public: private: ILogSink *m_logSink; + QList<ErrorInfo> m_warnings; + bool m_storeWarnings = false; }; |