Skip to content

Commit 5543a89

Browse files
committed
log more error messages
1 parent 61e0065 commit 5543a89

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

src/core/qgsdistancearea.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "qgsdistancearea.h"
2929
#include "qgsapplication.h"
3030
#include "qgslogger.h"
31+
#include "qgsmessagelog.h"
3132

3233
// MSVC compiler doesn't have defined M_PI in math.h
3334
#ifndef M_PI
@@ -101,7 +102,7 @@ bool QgsDistanceArea::setEllipsoid( const QString& ellipsoid )
101102
myResult = sqlite3_open( QgsApplication::srsDbFilePath().toUtf8().data(), &myDatabase );
102103
if ( myResult )
103104
{
104-
QgsDebugMsg( QString( "Can't open database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) );
105+
QgsMessageLog::logMessage( QObject::tr( "Can't open database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) );
105106
// XXX This will likely never happen since on open, sqlite creates the
106107
// database if it does not exist.
107108
return false;
@@ -363,7 +364,7 @@ double QgsDistanceArea::measureLine( const QList<QgsPoint>& points )
363364
catch ( QgsCsException &cse )
364365
{
365366
Q_UNUSED( cse );
366-
QgsLogger::warning( QObject::tr( "Caught a coordinate system exception while trying to transform a point. Unable to calculate line length." ) );
367+
QgsMessageLog::logMessage( QObject::tr( "Caught a coordinate system exception while trying to transform a point. Unable to calculate line length." ) );
367368
return 0.0;
368369
}
369370

@@ -388,7 +389,7 @@ double QgsDistanceArea::measureLine( const QgsPoint& p1, const QgsPoint& p2 )
388389
catch ( QgsCsException &cse )
389390
{
390391
Q_UNUSED( cse );
391-
QgsLogger::warning( QObject::tr( "Caught a coordinate system exception while trying to transform a point. Unable to calculate line length." ) );
392+
QgsMessageLog::logMessage( QObject::tr( "Caught a coordinate system exception while trying to transform a point. Unable to calculate line length." ) );
392393
return 0.0;
393394
}
394395
}
@@ -476,7 +477,7 @@ unsigned char* QgsDistanceArea::measurePolygon( unsigned char* feature, double*
476477
catch ( QgsCsException &cse )
477478
{
478479
Q_UNUSED( cse );
479-
QgsLogger::warning( QObject::tr( "Caught a coordinate system exception while trying to transform a point. Unable to calculate polygon area or perimeter." ) );
480+
QgsMessageLog::logMessage( QObject::tr( "Caught a coordinate system exception while trying to transform a point. Unable to calculate polygon area or perimeter." ) );
480481
}
481482

482483
return ptr;
@@ -505,7 +506,7 @@ double QgsDistanceArea::measurePolygon( const QList<QgsPoint>& points )
505506
catch ( QgsCsException &cse )
506507
{
507508
Q_UNUSED( cse );
508-
QgsLogger::warning( QObject::tr( "Caught a coordinate system exception while trying to transform a point. Unable to calculate polygon area." ) );
509+
QgsMessageLog::logMessage( QObject::tr( "Caught a coordinate system exception while trying to transform a point. Unable to calculate polygon area." ) );
509510
return 0.0;
510511
}
511512
}

src/core/qgsmimedatautils.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ QgsMimeDataUtils::Uri::Uri( QgsLayerItem* layerItem )
1616
case QgsMapLayer::RasterLayer:
1717
layerType = "raster";
1818
break;
19+
case QgsMapLayer::PluginLayer:
20+
layerType = "plugin";
21+
break;
1922
}
2023

2124
}

src/core/qgsproviderregistry.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "qgsdataprovider.h"
3030
#include "qgslogger.h"
3131
#include "qgsmessageoutput.h"
32+
#include "qgsmessagelog.h"
3233
#include "qgsprovidermetadata.h"
3334
#include "qgsvectorlayer.h"
3435

@@ -394,7 +395,8 @@ QgsDataProvider *QgsProviderRegistry::provider( QString const & providerKey, QSt
394395
return dataProvider;
395396
}
396397
else
397-
{ // this is likely because the dataSource is invalid, and isn't
398+
{
399+
// this is likely because the dataSource is invalid, and isn't
398400
// necessarily a reflection on the data provider itself
399401
QgsDebugMsg( "Invalid data provider" );
400402

@@ -405,7 +407,7 @@ QgsDataProvider *QgsProviderRegistry::provider( QString const & providerKey, QSt
405407
}
406408
else
407409
{
408-
QgsLogger::warning( "Unable to instantiate the data provider plugin" );
410+
QgsMessageLog::logMessage( QObject::tr( "Unable to instantiate the data provider plugin %1" ).arg( lib ) );
409411

410412
delete dataProvider;
411413

@@ -417,7 +419,7 @@ QgsDataProvider *QgsProviderRegistry::provider( QString const & providerKey, QSt
417419
}
418420
else
419421
{
420-
QgsLogger::warning( "Failed to load " + lib );
422+
QgsMessageLog::logMessage( QObject::tr( "Failed to load %1: %2" ).arg( lib ).arg( myLib->errorString() ) );
421423
delete myLib;
422424
return 0;
423425
}

src/core/qgsvectorlayerimport.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "qgsfeature.h"
2121
#include "qgsgeometry.h"
2222
#include "qgslogger.h"
23+
#include "qgsmessagelog.h"
2324
#include "qgscoordinatereferencesystem.h"
2425
#include "qgsvectorlayerimport.h"
2526
#include "qgsproviderregistry.h"
@@ -102,6 +103,7 @@ QgsVectorLayerImport::QgsVectorLayerImport(
102103

103104
if ( vectorProvider )
104105
delete vectorProvider;
106+
105107
return;
106108
}
107109

@@ -271,7 +273,7 @@ QgsVectorLayerImport::importLayer( QgsVectorLayer* layer,
271273

272274
QString msg = QObject::tr( "Failed to transform a point while drawing a feature of type '%1'. Writing stopped. (Exception: %2)" )
273275
.arg( fet.typeName() ).arg( e.what() );
274-
QgsLogger::warning( msg );
276+
QgsMessageLog::logMessage( msg, QObject::tr( "Vector import" ) );
275277
if ( errorMessage )
276278
*errorMessage = msg;
277279

0 commit comments

Comments
 (0)