diff options
| author | Thiago Macieira <thiago.macieira@intel.com> | 2021-09-22 19:31:32 -0700 |
|---|---|---|
| committer | Thiago Macieira <thiago.macieira@intel.com> | 2021-11-11 13:26:14 -0800 |
| commit | fba4ca0ec11d653791a7f6fb1e1d5e06103aeebb (patch) | |
| tree | 2f8d1af1826acdb4bee7f368a3bac48f64942c75 /src/corelib/plugin/qpluginloader.cpp | |
| parent | d36249e9759364a7025b531d1dfe89a891e65a4e (diff) | |
QLibrary/QPlugin/QFactoryLoader: convert to category logging
This adds three categories:
- qt.core.library
- qt.core.plugin.loader
- qt.core.plugin.factoryloader
plus the "qt.core.plugin.elfparser" category (only available in
developer builds).
All three use the new Q_LOGGING_CATEGORY_WITH_ENV_OVERRIDE technique
which enables their debugging if the QT_DEBUG_PLUGINS=1 variable is set.
As a consequence, some warnings were downgraded to debug messages. I've
only left as warnings situations where a real problem occurred, since
they now get printed by default: failures to open or mmap a file,
corrupt plugin metadata (but not scan of non-plugins), use of
QPluginLoader with a static build of Qt.
Drive-by update of some messages to make them prettier and/or use
qUtf16Printable().
Change-Id: I3eb1bd30e0124f89a052fffd16a752acfe89c19e
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Diffstat (limited to 'src/corelib/plugin/qpluginloader.cpp')
| -rw-r--r-- | src/corelib/plugin/qpluginloader.cpp | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp index eca85eb82ee..fb691421496 100644 --- a/src/corelib/plugin/qpluginloader.cpp +++ b/src/corelib/plugin/qpluginloader.cpp @@ -271,8 +271,6 @@ static QString locatePlugin(const QString& fileName) const auto baseName = QStringView{fileName}.mid(slash + 1); const auto basePath = isAbsolute ? QStringView() : QStringView{fileName}.left(slash + 1); // keep the '/' - const bool debug = qt_debug_component(); - QStringList paths; if (isAbsolute) { paths.append(fileName.left(slash)); // don't include the '/' @@ -287,22 +285,19 @@ static QString locatePlugin(const QString& fileName) { QString pluginPath = basePath + prefix + baseName + suffix; const QString fn = path + QLatin1String("/lib") + pluginPath.replace(QLatin1Char('/'), QLatin1Char('_')); - if (debug) - qDebug() << "Trying..." << fn; + qCDebug(qt_lcDebugPlugins) << "Trying..." << fn; if (QFileInfo(fn).isFile()) return fn; } #endif const QString fn = path + QLatin1Char('/') + basePath + prefix + baseName + suffix; - if (debug) - qDebug() << "Trying..." << fn; + qCDebug(qt_lcDebugPlugins) << "Trying..." << fn; if (QFileInfo(fn).isFile()) return fn; } } } - if (debug) - qDebug() << fileName << "not found"; + qCDebug(qt_lcDebugPlugins) << fileName << "not found"; return QString(); } #endif @@ -347,11 +342,8 @@ void QPluginLoader::setFileName(const QString &fileName) d->updatePluginState(); #else - if (qt_debug_component()) { - qWarning("Cannot load %s into a statically linked Qt library.", - (const char *)QFile::encodeName(fileName)); - } - Q_UNUSED(fileName); + qCWarning(qt_lcDebugPlugins, "Cannot load '%ls' into a statically linked Qt library.", + qUtf16Printable(fileName)); #endif } |
