Skip to content

Commit

Permalink
Pipe critical message log errors to stderr in qgis_process
Browse files Browse the repository at this point in the history
Notably, this now outputs the full Python error trace when an
error occurs while loading a plugin
  • Loading branch information
nyalldawson committed Apr 16, 2020
1 parent 061e858 commit 359df3c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/process/qgsprocess.cpp
Expand Up @@ -32,6 +32,7 @@
#endif

#include <iostream>
#include <QObject>

ConsoleFeedback::ConsoleFeedback()
{
Expand Down Expand Up @@ -151,6 +152,16 @@ QgsProcessingExec::QgsProcessingExec()

int QgsProcessingExec::run( const QStringList &args )
{
QObject::connect( QgsApplication::messageLog(), static_cast < void ( QgsMessageLog::* )( const QString &message, const QString &tag, Qgis::MessageLevel level ) >( &QgsMessageLog::messageReceived ), QgsApplication::instance(),
[ = ]( const QString & message, const QString &, Qgis::MessageLevel level )
{
if ( level == Qgis::Critical )
{
if ( !message.contains( QLatin1String( "DeprecationWarning:" ) ) )
std::cerr << message.toLocal8Bit().constData();
}
} );

if ( args.size() == 1 )
{
showUsage( args.at( 0 ) );
Expand Down

0 comments on commit 359df3c

Please sign in to comment.