QbsProjectManager: Logging improvements.

- Make messages with level "warning" or "error" appear in the Issues
  pane.
- Do not suppress messages of level "info". People add "console.info()"
  calls into their projects for debugging and they expect to see the
  output in Creator.

Task-number: QTCREATORBUG-15983
Change-Id: I6c84bc1ef08dbf85d7e88af864b18f64fcedfe1a
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
This commit is contained in:
Christian Kandeler
2016-05-26 15:27:41 +02:00
parent 74b6d2e708
commit d89fc0bfea
2 changed files with 5 additions and 1 deletions

View File

@@ -79,6 +79,10 @@ void QbsLogSink::doPrintMessage(qbs::LoggerLevel level, const QString &message,
{ {
QMutexLocker l(&m_mutex); QMutexLocker l(&m_mutex);
if (level <= qbs::LoggerWarning) {
doPrintWarning(qbs::ErrorInfo(message));
return;
}
m_messages.append(qbs::logLevelTag(level) + message); m_messages.append(qbs::logLevelTag(level) + message);
} }
QMetaObject::invokeMethod(this, "sendMessages", Qt::QueuedConnection); QMetaObject::invokeMethod(this, "sendMessages", Qt::QueuedConnection);

View File

@@ -78,7 +78,7 @@ QbsManager::QbsManager() :
this, &QbsManager::updateAllProfiles); this, &QbsManager::updateAllProfiles);
m_logSink = new QbsLogSink(this); m_logSink = new QbsLogSink(this);
int level = qbs::LoggerWarning; int level = qbs::LoggerInfo;
const QString levelEnv = QString::fromLocal8Bit(qgetenv("QBS_LOG_LEVEL")); const QString levelEnv = QString::fromLocal8Bit(qgetenv("QBS_LOG_LEVEL"));
if (!levelEnv.isEmpty()) { if (!levelEnv.isEmpty()) {
bool ok = false; bool ok = false;