Skip to content
Snippets Groups Projects
Commit a7fa0dd4 authored by El Mehdi Fekari's avatar El Mehdi Fekari Committed by Mehdi Fekari
Browse files

Qnx: Fix slog2er parsing when logs contain \n


If the logs contain a '\n' the message parts in the new lines are not displayed.
The new line messages are displayed with no buffer details and are ignored
when the parsing is processed.

Change-Id: I0e174dd5283a64c4e9b0434c06dd417f1be2c810
Reviewed-by: default avatarTobias Nätterlund <tobias.naetterlund@kdab.com>
Reviewed-by: default avatarNicolas Arnaud-Cormos <nicolas@kdab.com>
parent 2e3e11d0
No related branches found
No related tags found
No related merge requests found
...@@ -59,6 +59,7 @@ BlackBerryApplicationRunner::BlackBerryApplicationRunner(bool debugMode, BlackBe ...@@ -59,6 +59,7 @@ BlackBerryApplicationRunner::BlackBerryApplicationRunner(bool debugMode, BlackBe
: QObject(parent) : QObject(parent)
, m_debugMode(debugMode) , m_debugMode(debugMode)
, m_slog2infoFound(false) , m_slog2infoFound(false)
, m_currentLogs(false)
, m_pid(-1) , m_pid(-1)
, m_appId(QString()) , m_appId(QString())
, m_running(false) , m_running(false)
...@@ -155,6 +156,7 @@ ProjectExplorer::RunControl::StopResult BlackBerryApplicationRunner::stop() ...@@ -155,6 +156,7 @@ ProjectExplorer::RunControl::StopResult BlackBerryApplicationRunner::stop()
return ProjectExplorer::RunControl::AsynchronousStop; return ProjectExplorer::RunControl::AsynchronousStop;
m_stopping = true; m_stopping = true;
m_currentLogs = false;
if (m_testSlog2Process && m_testSlog2Process->isProcessRunning()) { if (m_testSlog2Process && m_testSlog2Process->isProcessRunning()) {
m_testSlog2Process->cancel(); m_testSlog2Process->cancel();
...@@ -312,19 +314,33 @@ void BlackBerryApplicationRunner::handleTailOutput() ...@@ -312,19 +314,33 @@ void BlackBerryApplicationRunner::handleTailOutput()
if (m_slog2infoFound) { if (m_slog2infoFound) {
const QStringList multiLine = message.split(QLatin1Char('\n')); const QStringList multiLine = message.split(QLatin1Char('\n'));
Q_FOREACH (const QString &line, multiLine) { Q_FOREACH (const QString &line, multiLine) {
QDateTime dateTime = QDateTime::fromString(line.split(m_appId).first().mid(4).trimmed(), // Check if logs are from the recent launch
QString::fromLatin1("dd HH:mm:ss.zzz")); // Note: This is useless if/once slog2info -b displays only logs from recent launches
if (dateTime >= m_launchDateTime) { if (!m_currentLogs) {
QStringList validLineBeginnings; QDateTime dateTime = QDateTime::fromString(line.split(m_appId).first().mid(4).trimmed(),
validLineBeginnings << QLatin1String("qt-msg 0 ") QString::fromLatin1("dd HH:mm:ss.zzz"));
<< QLatin1String("qt-msg* 0 ")
<< QLatin1String("default* 9000 ") m_currentLogs = dateTime >= m_launchDateTime;
<< QLatin1String("default 9000 ") if (!m_currentLogs)
<< QLatin1String(" 0 "); continue;
Q_FOREACH (const QString &beginning, validLineBeginnings) { }
if (showQtMessage(beginning, line))
break; // The line could be a part of a previous log message that contains a '\n'
} // In that case only the message body is displayed
if (!line.contains(m_appId) && !line.isEmpty()) {
emit output(line + QLatin1Char('\n'), Utils::StdOutFormat);
continue;
}
QStringList validLineBeginnings;
validLineBeginnings << QLatin1String("qt-msg 0 ")
<< QLatin1String("qt-msg* 0 ")
<< QLatin1String("default* 9000 ")
<< QLatin1String("default 9000 ")
<< QLatin1String(" 0 ");
Q_FOREACH (const QString &beginning, validLineBeginnings) {
if (showQtMessage(beginning, line))
break;
} }
} }
return; return;
......
...@@ -104,6 +104,7 @@ private: ...@@ -104,6 +104,7 @@ private:
bool m_debugMode; bool m_debugMode;
bool m_slog2infoFound; bool m_slog2infoFound;
bool m_currentLogs;
QDateTime m_launchDateTime; QDateTime m_launchDateTime;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment