Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Nicer level string in message log window
  • Loading branch information
NathanW2 committed Jul 24, 2017
1 parent d055def commit 601dd41
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/gui/qgsmessagelogviewer.cpp
Expand Up @@ -75,9 +75,26 @@ void QgsMessageLogViewer::logMessage( const QString &message, const QString &tag
tabWidget->setTabsClosable( true );
}

QString levelString;
switch ( level )
{
case QgsMessageLog::INFO:
levelString = "INFO";
break;
case QgsMessageLog::WARNING:
levelString = "WARNING";
break;
case QgsMessageLog::CRITICAL:
levelString = "CRITICAL";
break;
case QgsMessageLog::NONE:
levelString = "NONE";
break;
}

QString prefix = QStringLiteral( "%1\t%2\t" )
.arg( QDateTime::currentDateTime().toString( Qt::ISODate ) )
.arg( level );
.arg( levelString );
QString cleanedMessage = message;
cleanedMessage = cleanedMessage.prepend( prefix ).replace( '\n', QLatin1String( "\n\t\t\t" ) );
w->appendPlainText( cleanedMessage );
Expand Down

0 comments on commit 601dd41

Please sign in to comment.