Skip to content
Permalink
Browse files

Push more debugging messages down a level

Part of an ongoing campaign to see only unexpected error messages
reported on debug level 1
  • Loading branch information
nyalldawson committed May 18, 2020
1 parent 2258e24 commit 768e996c0b5c4636562caaf683ba2f82b2d6ccf1
@@ -289,7 +289,7 @@ void QgsPluginManager::loadPlugin( const QString &id )
pRegistry->loadCppPlugin( library );
}

QgsDebugMsg( "Plugin loaded: " + library );
QgsDebugMsgLevel( "Plugin loaded: " + library, 2 );
QApplication::restoreOverrideCursor();
}

@@ -310,12 +310,12 @@ void QgsPluginManager::unloadPlugin( const QString &id )
if ( plugin->value( QStringLiteral( "pythonic" ) ) == QLatin1String( "true" ) )
{
library = plugin->value( QStringLiteral( "id" ) );
QgsDebugMsg( "Unloading Python plugin: " + library );
QgsDebugMsgLevel( "Unloading Python plugin: " + library, 2 );
pRegistry->unloadPythonPlugin( library );
}
else // C++ plugin
{
QgsDebugMsg( "Unloading C++ plugin: " + library );
QgsDebugMsgLevel( "Unloading C++ plugin: " + library, 2 );
pRegistry->unloadCppPlugin( library );
}
}
@@ -408,17 +408,17 @@ void QgsPluginManager::getCppPluginsMetadata()
#endif //#ifndef Q_OS_WIN && Q_OS_MACX
#endif //#ifdef TESTLIB

QgsDebugMsg( "Examining: " + lib );
QgsDebugMsgLevel( "Examining: " + lib, 2 );
QLibrary *myLib = new QLibrary( lib );
bool loaded = myLib->load();
if ( !loaded )
{
QgsDebugMsg( QStringLiteral( "Failed to load: %1 (%2)" ).arg( myLib->fileName(), myLib->errorString() ) );
QgsDebugMsgLevel( QStringLiteral( "Failed to load: %1 (%2)" ).arg( myLib->fileName(), myLib->errorString() ), 2 );
delete myLib;
continue;
}

QgsDebugMsg( "Loaded library: " + myLib->fileName() );
QgsDebugMsgLevel( "Loaded library: " + myLib->fileName(), 2 );
//Type is only used in non-provider plugins, so data providers are not picked
if ( !myLib->resolve( "type" ) )
{
@@ -439,64 +439,64 @@ void QgsPluginManager::getCppPluginsMetadata()
// show the values (or lack of) for each function
if ( pName )
{
QgsDebugMsg( "Plugin name: " + pName() );
QgsDebugMsgLevel( "Plugin name: " + pName(), 2 );
}
else
{
QgsDebugMsg( QStringLiteral( "Plugin name not returned when queried" ) );
QgsDebugMsgLevel( QStringLiteral( "Plugin name not returned when queried" ), 2 );
}
if ( pDesc )
{
QgsDebugMsg( "Plugin description: " + pDesc() );
QgsDebugMsgLevel( "Plugin description: " + pDesc(), 2 );
}
else
{
QgsDebugMsg( QStringLiteral( "Plugin description not returned when queried" ) );
QgsDebugMsgLevel( QStringLiteral( "Plugin description not returned when queried" ), 2 );
}
if ( pCat )
{
QgsDebugMsg( "Plugin category: " + pCat() );
QgsDebugMsgLevel( "Plugin category: " + pCat(), 2 );
}
else
{
QgsDebugMsg( QStringLiteral( "Plugin category not returned when queried" ) );
QgsDebugMsgLevel( QStringLiteral( "Plugin category not returned when queried" ), 2 );
}
if ( pVersion )
{
QgsDebugMsg( "Plugin version: " + pVersion() );
QgsDebugMsgLevel( "Plugin version: " + pVersion(), 2 );
}
else
{
QgsDebugMsg( QStringLiteral( "Plugin version not returned when queried" ) );
QgsDebugMsgLevel( QStringLiteral( "Plugin version not returned when queried" ), 2 );
}
if ( pIcon )
{
QgsDebugMsg( "Plugin icon: " + pIcon() );
QgsDebugMsgLevel( "Plugin icon: " + pIcon(), 2 );
}
else
{
QgsDebugMsg( QStringLiteral( "Plugin icon not returned when queried" ) );
QgsDebugMsgLevel( QStringLiteral( "Plugin icon not returned when queried" ), 2 );
}
if ( pCreateDate )
{
QgsDebugMsg( "Plugin create date: " + pCreateDate() );
QgsDebugMsgLevel( "Plugin create date: " + pCreateDate(), 2 );
}
else
{
QgsDebugMsg( QStringLiteral( "Plugin create date not returned when queried" ) );
QgsDebugMsgLevel( QStringLiteral( "Plugin create date not returned when queried" ), 2 );
}
if ( pUpdateDate )
{
QgsDebugMsg( "Plugin update date: " + pUpdateDate() );
QgsDebugMsgLevel( "Plugin update date: " + pUpdateDate(), 2 );
}
else
{
QgsDebugMsg( QStringLiteral( "Plugin update date not returned when queried" ) );
QgsDebugMsgLevel( QStringLiteral( "Plugin update date not returned when queried" ), 2 );
}

if ( !pName || !pDesc || !pVersion )
{
QgsDebugMsg( "Failed to get name, description, or type for " + myLib->fileName() );
QgsDebugMsgLevel( "Failed to get name, description, or type for " + myLib->fileName(), 2 );
delete myLib;
continue;
}
@@ -11735,7 +11735,7 @@ void QgisApp::loadPythonSupport()
pythonlibName.prepend( "lib" );
#endif
QString version = QStringLiteral( "%1.%2.%3" ).arg( Qgis::versionInt() / 10000 ).arg( Qgis::versionInt() / 100 % 100 ).arg( Qgis::versionInt() % 100 );
QgsDebugMsg( QStringLiteral( "load library %1 (%2)" ).arg( pythonlibName, version ) );
QgsDebugMsgLevel( QStringLiteral( "load library %1 (%2)" ).arg( pythonlibName, version ), 2 );
QLibrary pythonlib( pythonlibName, version );
// It's necessary to set these two load hints, otherwise Python library won't work correctly
// see http://lists.kde.org/?l=pykde&m=117190116820758&w=2
@@ -12321,9 +12321,9 @@ QgsVectorLayer *QgisApp::addVectorLayerPrivate( const QString &vectorLayerPath,
The caller is responsible for cobbling together the needed information to
open the layer
*/
QgsDebugMsg( "Creating new vector layer using " + vectorLayerPath
+ " with baseName of " + baseName
+ " and providerKey of " + providerKey );
QgsDebugMsgLevel( "Creating new vector layer using " + vectorLayerPath
+ " with baseName of " + baseName
+ " and providerKey of " + providerKey, 2 );

// if the layer needs authentication, ensure the master password is set
bool authok = true;
@@ -12346,7 +12346,7 @@ QgsVectorLayer *QgisApp::addVectorLayerPrivate( const QString &vectorLayerPath,
if ( authok && layer && layer->isValid() )
{
QStringList sublayers = layer->dataProvider()->subLayers();
QgsDebugMsg( QStringLiteral( "got valid layer with %1 sublayers" ).arg( sublayers.count() ) );
QgsDebugMsgLevel( QStringLiteral( "got valid layer with %1 sublayers" ).arg( sublayers.count() ), 2 );

// If the newly created layer has more than 1 layer of data available, we show the
// sublayers selection dialog so the user can select the sublayers to actually load.
@@ -128,7 +128,7 @@ QTreeWidgetItem *QgsCustomizationDialog::item( const QString &path, QTreeWidgetI
}
}
}
QgsDebugMsg( QStringLiteral( "not found" ) );
QgsDebugMsgLevel( QStringLiteral( "not found" ), 2 );
return nullptr;
}

@@ -174,7 +174,7 @@ bool QgsCustomizationDialog::filterItems( const QString &text )

bool QgsCustomizationDialog::itemChecked( const QString &path )
{
QgsDebugMsg( QStringLiteral( "thePath = %1" ).arg( path ) );
QgsDebugMsgLevel( QStringLiteral( "thePath = %1" ).arg( path ), 3 );
QTreeWidgetItem *myItem = item( path );
if ( !myItem )
return true;
@@ -183,7 +183,7 @@ bool QgsCustomizationDialog::itemChecked( const QString &path )

void QgsCustomizationDialog::setItemChecked( const QString &path, bool on )
{
QgsDebugMsg( QStringLiteral( "thePath = %1 on = %2" ).arg( path ).arg( on ) );
QgsDebugMsgLevel( QStringLiteral( "thePath = %1 on = %2" ).arg( path ).arg( on ), 2 );
QTreeWidgetItem *myItem = item( path );
if ( !myItem )
return;
@@ -263,7 +263,7 @@ void QgsCustomizationDialog::ok()
}
void QgsCustomizationDialog::apply()
{
QgsDebugMsg( QStringLiteral( "columnCount = %1" ).arg( treeWidget->columnCount() ) );
QgsDebugMsgLevel( QStringLiteral( "columnCount = %1" ).arg( treeWidget->columnCount() ), 3 );
treeToSettings( mSettings );
mSettings->setValue( QgsCustomization::instance()->statusPath(), QgsCustomization::User );
mSettings->sync();
@@ -418,7 +418,7 @@ QTreeWidgetItem *QgsCustomizationDialog::readWidgetsXmlNode( const QDomNode &nod
// There are 47 png files, total 196K in qt/tools/designer/src/components/formeditor/images/
QString iconName = myElement.attribute( QStringLiteral( "class" ), QString() ).toLower().mid( 1 ) + ".png";
QString iconPath = QgsApplication::iconPath( "/customization/" + iconName );
QgsDebugMsg( "iconPath = " + iconPath );
QgsDebugMsgLevel( "iconPath = " + iconPath, 3 );
if ( QFile::exists( iconPath ) )
{
myItem->setIcon( 0, QIcon( iconPath ) );
@@ -447,7 +447,7 @@ bool QgsCustomizationDialog::switchWidget( QWidget *widget, QMouseEvent *e )
return false;

QString path = widgetPath( widget );
QgsDebugMsg( "path = " + path );
QgsDebugMsgLevel( "path = " + path, 3 );

if ( path.contains( QLatin1String( "/QgsCustomizationDialogBase" ) ) )
{
@@ -484,10 +484,10 @@ bool QgsCustomizationDialog::switchWidget( QWidget *widget, QMouseEvent *e )
path = "/Widgets" + path;
}

QgsDebugMsg( "path final = " + path );
QgsDebugMsgLevel( "path final = " + path, 3 );
bool on = !itemChecked( path );

QgsDebugMsg( QStringLiteral( "on = %1" ).arg( on ) );
QgsDebugMsgLevel( QStringLiteral( "on = %1" ).arg( on ), 3 );

setItemChecked( path, on );
QTreeWidgetItem *myItem = item( path );
@@ -937,9 +937,9 @@ void QgsCustomization::customizeWidget( QWidget *widget, QEvent *event, QSetting
if ( !widget->inherits( "QDialog" ) )
return;

QgsDebugMsg( QStringLiteral( "objectName = %1 event type = %2" ).arg( widget->objectName() ).arg( event->type() ) );
QgsDebugMsgLevel( QStringLiteral( "objectName = %1 event type = %2" ).arg( widget->objectName() ).arg( event->type() ), 3 );

QgsDebugMsg( QStringLiteral( "%1 x %2" ).arg( widget->metaObject()->className(), QDialog::staticMetaObject.className() ) );
QgsDebugMsgLevel( QStringLiteral( "%1 x %2" ).arg( widget->metaObject()->className(), QDialog::staticMetaObject.className() ), 3 );
QString path = QStringLiteral( "/Customization/Widgets/" );

QgsCustomization::customizeWidget( path, widget, settings );
@@ -980,13 +980,13 @@ void QgsCustomization::customizeWidget( const QString &path, QWidget *widget, QS
QLayout *l = widget->layout();
if ( l )
{
QgsDebugMsg( QStringLiteral( "remove" ) );
QgsDebugMsgLevel( QStringLiteral( "remove" ), 3 );
QgsCustomization::removeFromLayout( l, w );
w->hide();
}
else
{
QgsDebugMsg( QStringLiteral( "hide" ) );
QgsDebugMsgLevel( QStringLiteral( "hide" ), 3 );
w->hide();
}
}
@@ -1108,14 +1108,14 @@ void QgsCustomization::loadDefault()
QString path = QgsApplication::pkgDataPath() + "/resources/customization.ini";
if ( ! QFile::exists( path ) )
{
QgsDebugMsg( "Default customization not found in " + path );
QgsDebugMsgLevel( "Default customization not found in " + path, 2 );
return;
}
QgsDebugMsg( "Loading default customization from " + path );
QgsDebugMsgLevel( "Loading default customization from " + path, 2 );

QSettings fileSettings( path );
QStringList keys = fileSettings.allKeys();
QgsDebugMsg( QStringLiteral( "size = %1" ).arg( keys.size() ) );
QgsDebugMsgLevel( QStringLiteral( "size = %1" ).arg( keys.size() ), 2 );
QStringList::const_iterator i;
for ( i = keys.constBegin(); i != keys.constEnd(); ++i )
{
@@ -375,25 +375,25 @@ void QgsPluginRegistry::loadCppPlugin( const QString &fullPathName )
QObject *o = dynamic_cast<QObject *>( pl );
if ( o )
{
QgsDebugMsg( QStringLiteral( "plugin object name: %1" ).arg( o->objectName() ) );
QgsDebugMsgLevel( QStringLiteral( "plugin object name: %1" ).arg( o->objectName() ), 2 );
if ( o->objectName().isEmpty() )
{
#ifndef Q_OS_WIN
baseName = baseName.mid( 3 );
#endif
QgsDebugMsg( QStringLiteral( "object name to %1" ).arg( baseName ) );
QgsDebugMsgLevel( QStringLiteral( "object name to %1" ).arg( baseName ), 2 );
o->setObjectName( QStringLiteral( "qgis_plugin_%1" ).arg( baseName ) );
QgsDebugMsg( QStringLiteral( "plugin object name now: %1" ).arg( o->objectName() ) );
QgsDebugMsgLevel( QStringLiteral( "plugin object name now: %1" ).arg( o->objectName() ), 2 );
}

if ( !o->parent() )
{
QgsDebugMsg( QStringLiteral( "setting plugin parent" ) );
QgsDebugMsgLevel( QStringLiteral( "setting plugin parent" ), 2 );
o->setParent( QgisApp::instance() );
}
else
{
QgsDebugMsg( QStringLiteral( "plugin parent already set" ) );
QgsDebugMsgLevel( QStringLiteral( "plugin parent already set" ), 2 );
}
}

@@ -520,7 +520,7 @@ void QgsPluginRegistry::restoreSessionPlugins( const QString &pluginDirString )
{
// check for python plugins system-wide
QStringList pluginList = mPythonUtils->pluginList();
QgsDebugMsg( QStringLiteral( "Loading python plugins" ) );
QgsDebugMsgLevel( QStringLiteral( "Loading python plugins" ), 2 );

QStringList corePlugins = QStringList();
corePlugins << QStringLiteral( "GdalTools" );
@@ -583,7 +583,7 @@ void QgsPluginRegistry::restoreSessionPlugins( const QString &pluginDirString )
}
#endif

QgsDebugMsg( QStringLiteral( "Plugin loading completed" ) );
QgsDebugMsgLevel( QStringLiteral( "Plugin loading completed" ), 2 );
}


@@ -605,7 +605,7 @@ bool QgsPluginRegistry::checkCppPlugin( const QString &pluginFullPath )
if ( myName && myDescription && myVersion && myCategory )
return true;

QgsDebugMsg( "Failed to get name, description, category or type for " + myLib.fileName() );
QgsDebugMsgLevel( "Failed to get name, description, category or type for " + myLib.fileName(), 2 );
return false;
}

@@ -89,7 +89,7 @@ bool Qgs2To3Migration::requiresMigration()
{
QStringList parts = line.split( '=' );
mMigrationFileVersion = parts.at( 1 ).toInt();
QgsDebugMsg( QStringLiteral( "File version is=%1" ).arg( mMigrationFileVersion ) );
QgsDebugMsgLevel( QStringLiteral( "File version is=%1" ).arg( mMigrationFileVersion ), 2 );
}
migrationFile.close();
}
@@ -107,7 +107,7 @@ QgsError Qgs2To3Migration::migrateStyles()
QgsError error;
QString oldHome = QStringLiteral( "%1/.qgis2" ).arg( QDir::homePath() );
QString oldStyleFile = QStringLiteral( "%1/symbology-ng-style.db" ).arg( oldHome );
QgsDebugMsg( QStringLiteral( "OLD STYLE FILE %1" ).arg( oldStyleFile ) );
QgsDebugMsgLevel( QStringLiteral( "OLD STYLE FILE %1" ).arg( oldStyleFile ), 2 );
QSqlDatabase db = QSqlDatabase::addDatabase( "QSQLITE", "migration" );
db.setDatabaseName( oldStyleFile );
if ( !db.open() )
@@ -150,7 +150,7 @@ QgsError Qgs2To3Migration::migrateStyles()
}

QDomElement symElement = doc.documentElement();
QgsDebugMsg( QStringLiteral( "MIGRATION: Importing %1" ).arg( name ) );
QgsDebugMsgLevel( QStringLiteral( "MIGRATION: Importing %1" ).arg( name ), 2 );
QgsSymbol *symbol = QgsSymbolLayerUtils::loadSymbol( symElement, QgsReadWriteContext() );
tags << "QGIS 2";
if ( style->symbolId( name ) == 0 )
@@ -160,7 +160,7 @@ QgsError Qgs2To3Migration::migrateStyles()
}
}

QgsDebugMsg( oldStyleFile );
QgsDebugMsgLevel( oldStyleFile, 2 );
return error;
}

@@ -234,7 +234,7 @@ QgsError Qgs2To3Migration::migrateSettings()

if ( keys.count() > 0 )
{
QgsDebugMsg( QStringLiteral( "MIGRATION: Translating settings keys" ) );
QgsDebugMsgLevel( QStringLiteral( "MIGRATION: Translating settings keys" ), 2 );
QList<QPair<QString, QString>>::iterator i;
for ( i = keys.begin(); i != keys.end(); ++i )
{
@@ -245,7 +245,7 @@ QgsError Qgs2To3Migration::migrateSettings()

if ( oldKey.contains( oldKey ) )
{
QgsDebugMsg( QStringLiteral( " -> %1 -> %2" ).arg( oldKey, newKey ) );
QgsDebugMsgLevel( QStringLiteral( " -> %1 -> %2" ).arg( oldKey, newKey ), 2 );
newSettings.setValue( newKey, mOldSettings->value( oldKey ) );
}
}
@@ -276,7 +276,7 @@ QgsError Qgs2To3Migration::migrateAuthDb()
{
if ( oldDbFile.copy( newAuthDbFilePath ) )
{
QgsDebugMsg( QStringLiteral( "Old auth DB successfully copied to %1" ).arg( newAuthDbFilePath ) );
QgsDebugMsgLevel( QStringLiteral( "Old auth DB successfully copied to %1" ).arg( newAuthDbFilePath ), 2 );
}
else
{

0 comments on commit 768e996

Please sign in to comment.
You can’t perform that action at this time.