Skip to content

Commit

Permalink
Move some non-error debug messages to QgsDebugMsgLevel
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 25, 2019
1 parent 65ad06d commit 83dd2aa
Show file tree
Hide file tree
Showing 38 changed files with 138 additions and 142 deletions.
2 changes: 0 additions & 2 deletions python/core/auto_generated/qgsfield.sip.in
Expand Up @@ -299,9 +299,7 @@ Converts the provided variant to a compatible format
Py_BEGIN_ALLOW_THREADS
try
{
QgsDebugMsg( a0->toString() );
sipRes = sipCpp->convertCompatible( *a0 );
QgsDebugMsg( a0->toString() );
}
catch ( ... )
{
Expand Down
2 changes: 1 addition & 1 deletion src/app/layout/qgslayoutlegendwidget.cpp
Expand Up @@ -954,7 +954,7 @@ void QgsLayoutLegendWidget::resetLayerNodeToDefaults()

void QgsLayoutLegendWidget::mCountToolButton_clicked( bool checked )
{
QgsDebugMsg( QStringLiteral( "Entered." ) );
QgsDebugMsgLevel( QStringLiteral( "Entered." ), 4 );
if ( !mLegend )
{
return;
Expand Down
10 changes: 5 additions & 5 deletions src/app/qgisapp.cpp
Expand Up @@ -2002,8 +2002,8 @@ QList<QgsVectorLayerRef> QgisApp::findBrokenWidgetDependencies( QgsVectorLayer *
for ( const QgsVectorLayerRef &dependency : constDependencies )
{
const QgsVectorLayer *depVl { QgsVectorLayerRef( dependency ).resolveWeakly(
QgsProject::instance(),
QgsVectorLayerRef::MatchType::Name ) };
QgsProject::instance(),
QgsVectorLayerRef::MatchType::Name ) };
if ( ! depVl || ! depVl->isValid() )
{
brokenDependencies.append( dependency );
Expand Down Expand Up @@ -2094,8 +2094,8 @@ void QgisApp::checkVectorLayerDependencies( QgsVectorLayer *vl )
if ( ! loaded )
{
const QString msg { tr( "layer '%1' requires layer '%2' to be loaded but '%2' could not be found, please load it manually if possible." )
.arg( vl->name() )
.arg( dependency.name ) };
.arg( vl->name() )
.arg( dependency.name ) };
messageBar()->pushWarning( tr( "Missing layer form dependency" ), msg );
}
else
Expand Down Expand Up @@ -6458,7 +6458,7 @@ bool QgisApp::addProject( const QString &projectFile )
}

mMapCanvas->updateScale();
QgsDebugMsg( QStringLiteral( "Scale restored..." ) );
QgsDebugMsgLevel( QStringLiteral( "Scale restored..." ), 3 );

mActionFilterLegend->setChecked( QgsProject::instance()->readBoolEntry( QStringLiteral( "Legend" ), QStringLiteral( "filterByMap" ) ) );

Expand Down
4 changes: 2 additions & 2 deletions src/core/classification/qgsclassificationjenks.cpp
Expand Up @@ -83,8 +83,8 @@ QList<double> QgsClassificationJenks::calculateBreaks( double minimum, double ma

sample.resize( std::max( mMaximumSize, values.size() / 10 ) );

QgsDebugMsg( QStringLiteral( "natural breaks (jenks) sample size: %1" ).arg( sample.size() ) );
QgsDebugMsg( QStringLiteral( "values:%1" ).arg( values.size() ) );
QgsDebugMsgLevel( QStringLiteral( "natural breaks (jenks) sample size: %1" ).arg( sample.size() ), 2 );
QgsDebugMsgLevel( QStringLiteral( "values:%1" ).arg( values.size() ), 2 );

sample[ 0 ] = minimum;
sample[ 1 ] = maximum;
Expand Down
6 changes: 3 additions & 3 deletions src/core/dxf/qgsdxfpallabeling.cpp
Expand Up @@ -49,20 +49,20 @@ QgsDxfRuleBasedLabelProvider::QgsDxfRuleBasedLabelProvider( const QgsRuleBasedLa

void QgsDxfRuleBasedLabelProvider::reinit( QgsVectorLayer *layer )
{
QgsDebugMsg( QStringLiteral( "Entering." ) );
QgsDebugMsgLevel( QStringLiteral( "Entering." ), 4 );
mRules->rootRule()->createSubProviders( layer, mSubProviders, this );
}

QgsVectorLayerLabelProvider *QgsDxfRuleBasedLabelProvider::createProvider( QgsVectorLayer *layer, const QString &providerId, bool withFeatureLoop, const QgsPalLayerSettings *settings )
{
QgsDebugMsg( QStringLiteral( "Entering." ) );
QgsDebugMsgLevel( QStringLiteral( "Entering." ), 4 );
Q_UNUSED( withFeatureLoop )
return new QgsDxfLabelProvider( layer, providerId, mDxfExport, settings );
}

void QgsDxfRuleBasedLabelProvider::drawLabel( QgsRenderContext &context, pal::LabelPosition *label ) const
{
QgsDebugMsg( QStringLiteral( "Entering." ) );
QgsDebugMsgLevel( QStringLiteral( "Entering." ), 4 );
Q_ASSERT( mDxfExport );
mDxfExport->drawLabel( layerId(), context, label, mSettings );
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/expression/qgsexpression.cpp
Expand Up @@ -433,7 +433,7 @@ QString QgsExpression::replaceExpressionText( const QString &action, const QgsEx
const int start = index;
index = pos + match.capturedLength( 0 );
const QString toReplace = match.captured( 1 ).trimmed();
QgsDebugMsg( "Found expression: " + toReplace );
QgsDebugMsgLevel( "Found expression: " + toReplace, 3 );

QgsExpression exp( toReplace );
if ( exp.hasParserError() )
Expand All @@ -458,7 +458,7 @@ QString QgsExpression::replaceExpressionText( const QString &action, const QgsEx
continue;
}

QgsDebugMsg( "Expression result is: " + result.toString() );
QgsDebugMsgLevel( "Expression result is: " + result.toString(), 3 );
expr_action += action.mid( start, pos - start ) + result.toString();
}

Expand Down
8 changes: 4 additions & 4 deletions src/core/geocms/geonode/qgsgeonoderequest.cpp
Expand Up @@ -164,12 +164,12 @@ void QgsGeoNodeRequest::setProtocol( const QString &protocol )

void QgsGeoNodeRequest::replyFinished()
{
QgsDebugMsg( QStringLiteral( "Reply finished" ) );
QgsDebugMsgLevel( QStringLiteral( "Reply finished" ), 2 );
if ( !mIsAborted && mGeoNodeReply )
{
if ( mGeoNodeReply->error() == QNetworkReply::NoError )
{
QgsDebugMsg( QStringLiteral( "reply OK" ) );
QgsDebugMsgLevel( QStringLiteral( "reply OK" ), 2 );
QVariant redirect = mGeoNodeReply->attribute( QNetworkRequest::RedirectionTargetAttribute );
if ( !redirect.isNull() )
{
Expand Down Expand Up @@ -218,7 +218,7 @@ void QgsGeoNodeRequest::replyFinished()
}
cmd.setRawHeaders( hl );

QgsDebugMsg( QStringLiteral( "expirationDate:%1" ).arg( cmd.expirationDate().toString() ) );
QgsDebugMsgLevel( QStringLiteral( "expirationDate:%1" ).arg( cmd.expirationDate().toString() ), 2 );
if ( cmd.expirationDate().isNull() )
{
QgsSettings settings;
Expand Down Expand Up @@ -517,7 +517,7 @@ void QgsGeoNodeRequest::request( const QString &endPoint )
mIsAborted = false;
// Handle case where the endpoint is full url
QString url = endPoint.startsWith( mBaseUrl ) ? endPoint : mBaseUrl + endPoint;
QgsDebugMsg( "Requesting to " + url );
QgsDebugMsgLevel( "Requesting to " + url, 2 );
setProtocol( url.split( QStringLiteral( "://" ) ).at( 0 ) );
QUrl layerUrl( url );
layerUrl.setScheme( protocol() );
Expand Down
4 changes: 2 additions & 2 deletions src/core/geometry/qgsgeometrymakevalid.cpp
Expand Up @@ -348,7 +348,7 @@ static bool lwcollection_make_geos_friendly( QgsGeometryCollection *g );
// Ensure the geometry is "structurally" valid (enough for GEOS to accept it)
static bool lwgeom_make_geos_friendly( QgsAbstractGeometry *geom )
{
QgsDebugMsg( QStringLiteral( "lwgeom_make_geos_friendly enter (type %1)" ).arg( geom->wkbType() ) );
QgsDebugMsgLevel( QStringLiteral( "lwgeom_make_geos_friendly enter (type %1)" ).arg( geom->wkbType() ), 3 );
switch ( QgsWkbTypes::flatType( geom->wkbType() ) )
{
case QgsWkbTypes::Point:
Expand Down Expand Up @@ -911,7 +911,7 @@ std::unique_ptr< QgsAbstractGeometry > _qgis_lwgeom_make_valid( const QgsAbstrac
geos::unique_ptr geosgeom = QgsGeos::asGeos( lwgeom_in );
if ( !geosgeom )
{
QgsDebugMsg( QStringLiteral( "Original geom can't be converted to GEOS - will try cleaning that up first" ) );
QgsDebugMsgLevel( QStringLiteral( "Original geom can't be converted to GEOS - will try cleaning that up first" ), 3 );

std::unique_ptr<QgsAbstractGeometry> lwgeom_in_clone( lwgeom_in->clone() );
if ( !lwgeom_make_geos_friendly( lwgeom_in_clone.get() ) )
Expand Down
2 changes: 1 addition & 1 deletion src/core/gps/qgsgpsdconnection.cpp
Expand Up @@ -33,7 +33,7 @@ QgsGpsdConnection::QgsGpsdConnection( const QString &host, qint16 port, const QS

void QgsGpsdConnection::connected()
{
QgsDebugMsg( QStringLiteral( "connected!" ) );
QgsDebugMsgLevel( QStringLiteral( "connected!" ), 2 );
QTcpSocket *socket = qobject_cast< QTcpSocket * >( mSource );
socket->write( QStringLiteral( "?WATCH={\"enable\":true,\"nmea\":true,\"raw\":true%1};" ).arg( mDevice.isEmpty() ? mDevice : QStringLiteral( ",\"device\":%1" ).arg( mDevice ) ).toUtf8() );
}
Expand Down
30 changes: 15 additions & 15 deletions src/core/gps/qgsnmeaconnection.cpp
Expand Up @@ -56,7 +56,7 @@ void QgsNmeaConnection::parseData()
numBytes = mSource->bytesAvailable();
}

QgsDebugMsg( "numBytes:" + QString::number( numBytes ) );
QgsDebugMsgLevel( "numBytes:" + QString::number( numBytes ), 2 );

if ( numBytes >= 6 )
{
Expand Down Expand Up @@ -96,17 +96,17 @@ void QgsNmeaConnection::processStringBuffer()
QByteArray ba = substring.toLocal8Bit();
if ( substring.startsWith( QLatin1String( "$GPGGA" ) ) )
{
QgsDebugMsg( substring );
QgsDebugMsgLevel( substring, 2 );
processGgaSentence( ba.data(), ba.length() );
mStatus = GPSDataReceived;
QgsDebugMsg( QStringLiteral( "*******************GPS data received****************" ) );
QgsDebugMsgLevel( QStringLiteral( "*******************GPS data received****************" ), 2 );
}
else if ( substring.startsWith( QLatin1String( "$GPRMC" ) ) || substring.startsWith( QLatin1String( "$GNRMC" ) ) )
{
QgsDebugMsg( substring );
QgsDebugMsgLevel( substring, 2 );
processRmcSentence( ba.data(), ba.length() );
mStatus = GPSDataReceived;
QgsDebugMsg( QStringLiteral( "*******************GPS data received****************" ) );
QgsDebugMsgLevel( QStringLiteral( "*******************GPS data received****************" ), 2 );
}
else if ( substring.startsWith( QLatin1String( "$GPGSV" ) ) )
{
Expand All @@ -117,24 +117,24 @@ void QgsNmeaConnection::processStringBuffer()
}
else if ( substring.startsWith( QLatin1String( "$GPVTG" ) ) )
{
QgsDebugMsg( substring );
QgsDebugMsgLevel( substring, 2 );
processVtgSentence( ba.data(), ba.length() );
mStatus = GPSDataReceived;
QgsDebugMsg( QStringLiteral( "*******************GPS data received****************" ) );
QgsDebugMsgLevel( QStringLiteral( "*******************GPS data received****************" ), 2 );
}
else if ( substring.startsWith( QLatin1String( "$GPGSA" ) ) )
{
QgsDebugMsg( substring );
QgsDebugMsgLevel( substring, 2 );
processGsaSentence( ba.data(), ba.length() );
mStatus = GPSDataReceived;
QgsDebugMsg( QStringLiteral( "*******************GPS data received****************" ) );
QgsDebugMsgLevel( QStringLiteral( "*******************GPS data received****************" ), 2 );
}
else if ( substring.startsWith( QLatin1String( "$GPGST" ) ) )
{
QgsDebugMsg( substring );
QgsDebugMsgLevel( substring, 2 );
processGstSentence( ba.data(), ba.length() );
mStatus = GPSDataReceived;
QgsDebugMsg( QStringLiteral( "*******************GPS data received****************" ) );
QgsDebugMsgLevel( QStringLiteral( "*******************GPS data received****************" ), 2 );
}
emit nmeaSentenceReceived( substring ); // added to be able to save raw data
}
Expand Down Expand Up @@ -214,10 +214,10 @@ void QgsNmeaConnection::processRmcSentence( const char *data, int len )
mLastGPSInformation.utcDateTime.setTimeSpec( Qt::UTC );
mLastGPSInformation.utcDateTime.setDate( date );
mLastGPSInformation.utcDateTime.setTime( time );
QgsDebugMsg( QStringLiteral( "utc time:" ) );
QgsDebugMsg( mLastGPSInformation.utcDateTime.toString() );
QgsDebugMsg( QStringLiteral( "local time:" ) );
QgsDebugMsg( mLastGPSInformation.utcDateTime.toLocalTime().toString() );
QgsDebugMsgLevel( QStringLiteral( "utc time:" ), 2 );
QgsDebugMsgLevel( mLastGPSInformation.utcDateTime.toString(), 2 );
QgsDebugMsgLevel( QStringLiteral( "local time:" ), 2 );
QgsDebugMsgLevel( mLastGPSInformation.utcDateTime.toLocalTime().toString(), 2 );
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/layout/qgslayoutitempicture.cpp
Expand Up @@ -356,7 +356,7 @@ void QgsLayoutItemPicture::refreshPicture( const QgsExpressionContext *context )
else if ( source.type() != QVariant::ByteArray )
{
source = source.toString().trimmed();
QgsDebugMsg( QStringLiteral( "exprVal PictureSource:%1" ).arg( source.toString() ) );
QgsDebugMsgLevel( QStringLiteral( "exprVal PictureSource:%1" ).arg( source.toString() ), 2 );
}
}

Expand Down
20 changes: 10 additions & 10 deletions src/core/providers/gdal/qgsgdalprovider.cpp
Expand Up @@ -156,7 +156,7 @@ QgsGdalProvider::QgsGdalProvider( const QString &uri, const ProviderOptions &opt
mGeoTransform[4] = 0;
mGeoTransform[5] = -1;

QgsDebugMsg( "constructing with uri '" + uri + "'." );
QgsDebugMsgLevel( "constructing with uri '" + uri + "'.", 1 );

QgsGdalProviderBase::registerGdalDrivers();

Expand Down Expand Up @@ -305,15 +305,15 @@ bool QgsGdalProvider::crsFromWkt( const char *wkt )
QString authid = QStringLiteral( "%1:%2" )
.arg( OSRGetAuthorityName( hCRS, nullptr ),
OSRGetAuthorityCode( hCRS, nullptr ) );
QgsDebugMsg( "authid recognized as " + authid );
QgsDebugMsgLevel( "authid recognized as " + authid, 1 );
mCrs = QgsCoordinateReferenceSystem::fromOgcWmsCrs( authid );
}
else
{
// get the proj4 text
char *pszProj4 = nullptr;
OSRExportToProj4( hCRS, &pszProj4 );
QgsDebugMsg( pszProj4 );
QgsDebugMsgLevel( pszProj4, 1 );
CPLFree( pszProj4 );

char *pszWkt = nullptr;
Expand Down Expand Up @@ -743,7 +743,7 @@ bool QgsGdalProvider::readBlock( int bandNo, QgsRectangle const &extent, int pi
QgsRectangle rasterExtent = extent.intersect( mExtent );
if ( rasterExtent.isEmpty() )
{
QgsDebugMsg( QStringLiteral( "draw request outside view extent." ) );
QgsDebugMsgLevel( QStringLiteral( "draw request outside view extent." ), 2 );
return false;
}
QgsDebugMsgLevel( "extent: " + mExtent.toString(), 5 );
Expand Down Expand Up @@ -1350,7 +1350,7 @@ int QgsGdalProvider::colorInterpretation( int bandNo ) const

bool QgsGdalProvider::isValid() const
{
QgsDebugMsg( QStringLiteral( "valid = %1" ).arg( mValid ) );
QgsDebugMsgLevel( QStringLiteral( "valid = %1" ).arg( mValid ), 4 );
return mValid;
}

Expand Down Expand Up @@ -1412,7 +1412,7 @@ QStringList QgsGdalProvider::subLayers( GDALDatasetH dataset )

if ( !subLayers.isEmpty() )
{
QgsDebugMsg( "sublayers:\n " + subLayers.join( "\n " ) );
QgsDebugMsgLevel( "sublayers:\n " + subLayers.join( "\n " ), 3 );
}

return subLayers;
Expand All @@ -1429,7 +1429,7 @@ bool QgsGdalProvider::hasHistogram( int bandNo,
if ( !initIfNeeded() )
return false;

QgsDebugMsg( QStringLiteral( "theBandNo = %1 binCount = %2 minimum = %3 maximum = %4 sampleSize = %5" ).arg( bandNo ).arg( binCount ).arg( minimum ).arg( maximum ).arg( sampleSize ) );
QgsDebugMsgLevel( QStringLiteral( "theBandNo = %1 binCount = %2 minimum = %3 maximum = %4 sampleSize = %5" ).arg( bandNo ).arg( binCount ).arg( minimum ).arg( maximum ).arg( sampleSize ), 3 );

// First check if cached in mHistograms
if ( QgsRasterDataProvider::hasHistogram( bandNo, binCount, minimum, maximum, boundingBox, sampleSize, includeOutOfRange ) )
Expand All @@ -1450,19 +1450,19 @@ bool QgsGdalProvider::hasHistogram( int bandNo,
if ( ( sourceHasNoDataValue( bandNo ) && !useSourceNoDataValue( bandNo ) ) ||
!userNoDataValues( bandNo ).isEmpty() )
{
QgsDebugMsg( QStringLiteral( "Custom no data values -> GDAL histogram not sufficient." ) );
QgsDebugMsgLevel( QStringLiteral( "Custom no data values -> GDAL histogram not sufficient." ), 3 );
return false;
}

QgsDebugMsg( QStringLiteral( "Looking for GDAL histogram" ) );
QgsDebugMsgLevel( QStringLiteral( "Looking for GDAL histogram" ), 4 );

GDALRasterBandH myGdalBand = getBand( bandNo );
if ( ! myGdalBand )
{
return false;
}

// get default histogram with force=false to see if there is a cached histo
// get default histogram with force=false to see if there is a cached histo
double myMinVal, myMaxVal;
int myBinCount;

Expand Down
2 changes: 1 addition & 1 deletion src/core/providers/ogr/qgsogrdataitems.cpp
Expand Up @@ -291,7 +291,7 @@ static QgsOgrLayerItem *dataItemForLayer( QgsDataItem *parentItem, QString name,
{
// we are in a collection
name = QString::fromUtf8( OGR_FD_GetName( hDef ) );
QgsDebugMsg( "OGR layer name : " + name );
QgsDebugMsgLevel( "OGR layer name : " + name, 2 );
if ( !uniqueNames )
{
layerUri += "|layerid=" + QString::number( layerId );
Expand Down

0 comments on commit 83dd2aa

Please sign in to comment.